index!() { /* proc-macro */ }
Expand description
Derive Index
& IndexMut
implementations.
index!(Struct by Enum => mut u8:
UnitVariant => field_1,
pat Enum::Array(idx) if idx < 10 => pat array_field[idx],
pat Enum::Thing(Thing::One) => thing_1,
pat _ => thing_2,
);
See crate-level docs for a full example.