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