Function hdk::entry::create_entry

source ·
pub fn create_entry<I, E, E2>(input: I) -> ExternResult<ActionHash>where
    ScopedEntryDefIndex: for<'a> TryFrom<&'a I, Error = E2>,
    EntryVisibility: for<'a> From<&'a I>,
    Entry: TryFrom<I, Error = E>,
    WasmError: From<E> + From<E2>,
Expand description

Create an app entry. Also see create.

Apps define app entries by registering entry def ids with the entry_defs callback and serialize the entry content when committing to the source chain.

This function accepts any input that implements TryInto<CreateInput>. The implementations of the #hdk_entry_helper macro includes this.

With generic type handling it may make sense to directly construct CreateInput and create.

e.g.

#[hdk_entry_helper]
pub struct Foo(u32);

#[hdk_entry_defs]
pub enum EntryTypes {
   Foo(Foo)
}
create_entry(EntryTypes::Foo(Foo(50)))?;

See get and get_details for more information on CRUD.