1 2 3 4 5 6 7 8 9 10 11
use std::any::TypeId; pub trait TypeIDable { fn get_type_id() -> TypeId; } impl<T:'static> TypeIDable for T { fn get_type_id() -> TypeId { TypeId::of::<T>() } }