Crate typemap_meta[−][src]
Expand description
A simple compile-time derive macro to create type-to-value maps.
This approach in contrast to crates such as typemap
or type-map
that perform run-time lookup.
The static typing brings compile-time safety and faster execution at the expense
of using a derive macro and generics.
The crate is no_std
compatible.
Example
#[derive(Typemap)] struct Test(i32, f32); let t = Test(1, 2.0); assert_eq!(*get!(t, i32), 1); assert_eq!(*get!(t, f32), 2.0);
Macros
get | Convenience macro to get a specific type |
Traits
Get | Helper trait to get a specific type |
Derive Macros
Typemap | Add static type-to-value getters to a tuple struct containing disjoint heterogeneous types |