1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
use std::any::type_name; pub trait TypeName { /// Returns the name of this type. fn type_name(&self) -> &'static str; } impl<Item> TypeName for Vec<Item> { fn type_name(&self) -> &'static str { type_name::<Self>() } }