Enum concordium_std::EntryRaw
source · pub enum EntryRaw<StateApi: HasStateApi> {
Vacant(VacantEntryRaw<StateApi>),
Occupied(OccupiedEntryRaw<StateApi>),
}Expand description
A view into a single entry in a HasStateApi type,
which may either be vacant or occupied.
This enum is constructed from the entry
method on a HasStateApi type.
Variants§
Vacant(VacantEntryRaw<StateApi>)
Occupied(OccupiedEntryRaw<StateApi>)
Implementations§
source§impl<StateApi: HasStateApi> EntryRaw<StateApi>
impl<StateApi: HasStateApi> EntryRaw<StateApi>
sourcepub fn or_insert_raw(
self,
default: &[u8]
) -> Result<StateApi::EntryType, StateError>
pub fn or_insert_raw(
self,
default: &[u8]
) -> Result<StateApi::EntryType, StateError>
Ensures a value is in the entry by inserting the default if empty, and
returns the HasStateEntry type for the entry.
sourcepub fn or_insert<V: Serial>(self, default: &V) -> StateApi::EntryType
pub fn or_insert<V: Serial>(self, default: &V) -> StateApi::EntryType
Ensures a value is in the entry by inserting the default if empty, and
returns the HasStateEntry type. This differs from
or_insert_raw in that it automatically
serializes the provided value. or_insert should
be preferred for values that can be directly converted to byte
arrays, e.g., any value that implements AsRef<[u8]>.