Crate rkyv_typename[][src]

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);

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 unstable min_const_generics feature to implement array type names (enabled by default)
  • std: Implements TypeName for standard library types (enabled by default)

Traits

TypeName

Builds a name for a type.

Derive Macros

TypeName

Derives TypeName for the labeled type.