Expand description
Derive macros for the typex reflection traits.
Meta supports structs and enums. Add #[typex(opaque)] to expose only
runtime type information, or #[typex(partial_eq)] to delegate equality to
the type’s PartialEq implementation. MetaMut adds structural mutation
and requires Meta to be derived as well.
Generated code refers to ::typex, ::core and fully qualified prelude
items, so local items named Result, Option or core do not affect it.
Generated bindings use a __typex_ prefix to avoid capturing field names.
For generic types, the derives add a Meta or MetaMut bound for each
field type that mentions a type parameter. In a field type that contains
the derived type, they bound each part that mentions a type parameter but
not the derived type, instead of the whole field. This keeps types such as
struct Tree<T> { value: T, children: Vec<Tree<T>> } from overflowing
trait resolution.
Derive Macros§
- Meta
- Derives structural
typex::Metafor a struct or enum. - MetaMut
- Derives mutable
typex::MetaMutfor a struct or enum.