Skip to main content

Reflect

Derive Macro Reflect 

Source
#[derive(Reflect)]
{
    // Attributes available to this derive:
    #[reflect]
}
Expand description

Derives the Reflect trait for a struct or enum.

See the crate-level documentation for a description of the encoding.

Fields annotated with #[reflect(skip)] are excluded from the output.

§Examples

use reflect_derive::Reflect;
use reify_reflect_core::{Reflect, RuntimeValue};

#[derive(Reflect)]
struct Point {
    #[reflect(skip)]
    label: String,
    x: MyNat,
    y: MyNat,
}

#[derive(Reflect)]
struct Pair(MyNat, MyNat);

#[derive(Reflect)]
enum Shape {
    Point,
    Line(MyNat, MyNat),
    Box { w: MyNat, h: MyNat },
}