Derive
- Attached to a struct / enum.
- Generates additional tokens.
- Can have helper attributes.
- Cannot see sibling derives.
#[derive(CustomDerive)]
struct Struct; // Can see this.
// Can't see this.
impl Struct {
// ..
}
#[derive(Clone, Copy, a_crate::CustomDerive)]
#[custom_derive(Debug)] // type level helper attribute
enum Enum {
#[custom_derive(skip = "true")] // field level helper attribute
Variant0,
Variant1 { value: u32 },
}
This is not reflection!