Derive Macro ruststep_derive::Holder[][src]

#[derive(Holder)]
{
    // Attributes available to this derive:
    #[holder]
}
Expand description

Generates Holder struct and related implementation for each ENTITY struct

#[holder] attribute

There are three types of attributes:

#[derive(Holder)]
#[holder(table = Table)] // <- container attribute
#[holder(field = b)]     // <- this is also a container attribute
pub struct B {
    pub z: f64,
    #[holder(use_place_holder)] // <- field attribute
    pub a: A,
}

#[derive(Holder)]
#[holder(table = Table)] // <- container attribute
pub enum S2 {
    #[holder(use_place_holder)] // <- this is also a variant attribute
    A(Box<A>),
    P(f64),
}
  • #[holder(table = {path::to::table::struct})]
    • This must be a container attribute
    • Specify a struct path which contains a table for this Holder
  • #[holder(field = {field_ident})]
    • This can be both in container or variant attribute
    • Identifier of table field
  • #[holder(generate_deserialize)]
    • This must be a container attribute
    • Flag for generating impl Deserialize for XxxHolder
  • #[holder(use_place_holder)]
    • This can be both in field or variant attribute
    • Specify the field is not a simple type