2016-05-26 13:29:17 +00:00
|
|
|
use std::any::Any;
|
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
|
|
|
|
trait Bar {}
|
|
|
|
|
|
|
|
impl Bar for Foo {}
|
|
|
|
|
|
|
|
fn main() {
|
2019-05-28 18:46:13 +00:00
|
|
|
let any: &dyn Any = &Bar; //~ ERROR expected value, found trait `Bar`
|
2016-05-26 13:29:17 +00:00
|
|
|
if any.is::<u32>() { println!("u32"); }
|
|
|
|
}
|