Expand description

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

  • std: Implements TypeName for standard library types (enabled by default)

Traits

Builds a name for a type.

Derive Macros

Derives TypeName for the labeled type.