[−][src]Crate rkyv_typename
Type names for rkyv_dyn.
The goal of TypeName
is to avoid allocations if
possible. If all you need is the hash of a type name,
then there's no reason to allocate a string to do it.
rkyv_typename provides a derive macro to easily implement
TypeName
, and has options to easily customize your
type's name.
Examples
use rkyv_typename::TypeName; #[derive(TypeName)] #[typename = "CoolType"] struct Example<T>(T); fn main() { let mut type_name = String::new(); Example::<i32>::build_type_name(|piece| type_name += piece); assert_eq!(type_name, "CoolType<i32>"); }
Features
const_generics
: Uses the incompleteconst_generics
feature to implement array type names.std
: ImplementsTypeName
for standard library types.
By default, the std
feature is enabled.
Traits
TypeName | Builds a name for a type. |
Derive Macros
TypeName | Derives |