pub trait EntryTypesHelper: Sized {
fn try_from_local_type<I>(
type_index: I,
entry: &Entry
) -> Result<Option<Self>, WasmError>
where
LocalZomeTypeId: From<I>;
fn try_from_global_type<I>(
type_index: I,
entry: &Entry
) -> Result<Option<Self>, WasmError>
where
GlobalZomeTypeId: From<I>;
}
Expand description
Helper trait for deserializing Entry
s to the correct type.
This is implemented by the hdk_entry_defs
proc_macro.
Required Methods
fn try_from_local_type<I>(
type_index: I,
entry: &Entry
) -> Result<Option<Self>, WasmError> where
LocalZomeTypeId: From<I>,
fn try_from_local_type<I>(
type_index: I,
entry: &Entry
) -> Result<Option<Self>, WasmError> where
LocalZomeTypeId: From<I>,
Check if the LocalZomeTypeId
matches one of the Self LocalZomeTypeId
’s and if
it does deserialize the Entry
into that types.
fn try_from_global_type<I>(
type_index: I,
entry: &Entry
) -> Result<Option<Self>, WasmError> where
GlobalZomeTypeId: From<I>,
fn try_from_global_type<I>(
type_index: I,
entry: &Entry
) -> Result<Option<Self>, WasmError> where
GlobalZomeTypeId: From<I>,
Check if the GlobalZomeTypeId
maps to a LocalZomeTypeId
declared by Self and if
it does deserialize the Entry
into that types.