Attribute Macro hdk::prelude::hdk_entry_defs

source ·
#[hdk_entry_defs]
Expand description

Declares the integrity zome’s entry types.

Attributes

  • unit_enum(TypeName): Defines the unit version of this enum. The resulting enum contains all entry types defined in the integrity zome. It can be used to refer to a type when needed.
  • entry_def(name: String, required_validations: u8, visibility: String): Defines an entry type.
    • name: The name of the entry definition (optional). Defaults to the name of the enum variant.
    • required_validations: The number of validations required before this entry will not be published anymore (optional). Defaults to 5.
    • visibility: The visibility of this entry. [public | private]. Default is public.

Examples

#[hdk_entry_defs]
#[unit_enum(UnitEntryTypes)]
pub enum EntryTypes {
    Post(Post),
    #[entry_def(required_validations = 5)]
    Msg(Msg),
    #[entry_def(name = "hidden_msg", required_validations = 5, visibility = "private")]
    PrivMsg(PrivMsg),
}