Macro hdk::entry_def_index[][src]

macro_rules! entry_def_index {
    ( $t:ty ) => { ... };

Attempts to lookup the EntryDefIndex given an EntryDefId .

The EntryDefId is a String newtype and the EntryDefIndex is a u8 newtype. The EntryDefIndex is used to reference the entry type in headers on the DHT and as the index of the type exported to tooling. The EntryDefId is the ‘human friendly’ string that the [ entry_defs! ] callback maps to the index.

The host actually has no idea how to do this mapping, it is provided by the wasm!

Therefore this is a macro that calls the [ entry_defs! ] callback as defined within a zome directly from the zome. It is a macro so that we can call a function with a known name crate::entry_defs from the HDK before the function is defined.

Obviously this assumes and requires that a compliant [ entry_defs! ] callback is defined at the root of the crate.