Skip to main content

Crate reflect_derive

Crate reflect_derive 

Source
Expand description

§reflect-derive

Proc macro crate providing #[derive(Reflect)].

Generates a reify_reflect_core::Reflect implementation that emits a reify_reflect_core::RuntimeValue description of the type’s structural shape:

  • Named structRuntimeValue::List of (field_name_bytes, field_value) pairs.
  • Tuple structRuntimeValue::List of positional field values.
  • Unit struct (struct X;) → RuntimeValue::Unit.
  • Empty named struct (struct X {}) → RuntimeValue::List(vec![]).
  • EnumRuntimeValue::List of variant entries, each (variant_name_bytes, variant_payload), where the payload mirrors the per-variant shape (unit / tuple / named).

Fields whose types implement Reflect<Value = RuntimeValue> are reflected; fields annotated with #[reflect(skip)] are omitted.

Note: enum derivation reflects the type schema, not a runtime instance. The generated reflect() is a static method (matching the reify_reflect_core::Reflect trait), so it walks every variant and every variant’s field types.

Derive Macros§

Reflect
Derives the Reflect trait for a struct or enum.