Skip to main content

Entity

Derive Macro Entity 

Source
#[derive(Entity)]
{
    // Attributes available to this derive:
    #[id]
    #[graphite]
}
Expand description

Derive macro for entity types.

Generates Store trait implementation with load(), save(), and remove() methods.

§Example

#[derive(Entity)]
pub struct Transfer {
    #[id]
    id: String,
    from: Address,
    to: Address,
    value: BigInt,
}

The struct must have exactly one field marked with #[id].