Struct concordium_std::OccupiedEntryRaw
source · #[repr(transparent)]pub struct OccupiedEntryRaw<StateApi: HasStateApi> { /* private fields */ }
Expand description
A view into an occupied entry in a HasStateApi
type. It is part of the EntryRaw
enum.
Differs from OccupiedEntry
in that this has access to the raw bytes
stored in the state via a HasStateEntry
type.
Implementations§
source§impl<StateApi: HasStateApi> OccupiedEntryRaw<StateApi>
impl<StateApi: HasStateApi> OccupiedEntryRaw<StateApi>
sourcepub fn key(&self) -> &[u8] ⓘ
pub fn key(&self) -> &[u8] ⓘ
Gets a reference to the key that would be used when inserting a value
through the OccupiedEntryRaw
.
sourcepub fn get_ref(&self) -> &StateApi::EntryType
pub fn get_ref(&self) -> &StateApi::EntryType
Gets a reference to the HasStateEntry
type in the entry.
sourcepub fn get(self) -> StateApi::EntryType
pub fn get(self) -> StateApi::EntryType
Converts the entry into its HasStateEntry
type.
If you need multiple mutable references to the OccupiedEntryRaw
, see
get_mut
.
sourcepub fn get_mut(&mut self) -> &mut StateApi::EntryType
pub fn get_mut(&mut self) -> &mut StateApi::EntryType
Gets a mutable reference to the HasStateEntry
type in the entry.
If you need access to a HasStateEntry
, which can outlive the
OccupiedEntryRaw
, see get
.
sourcepub fn insert_raw(&mut self, value: &[u8])
pub fn insert_raw(&mut self, value: &[u8])
Sets the value of the entry with the OccupiedEntryRaw
’s key.
sourcepub fn insert<V: Serial>(&mut self, value: &V)
pub fn insert<V: Serial>(&mut self, value: &V)
Sets the value of the entry with the OccupiedEntryRaw
’s key.
This differs from insert_raw
in that it
automatically serializes the value. The insert
should be preferred if the value is already a byte array.