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
sourceimpl<StateApi: HasStateApi> OccupiedEntryRaw<StateApi>
impl<StateApi: HasStateApi> OccupiedEntryRaw<StateApi>
sourcepub fn key(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn key(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[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.
Auto Trait Implementations
impl<StateApi> RefUnwindSafe for OccupiedEntryRaw<StateApi> where
<StateApi as HasStateApi>::EntryType: RefUnwindSafe,
impl<StateApi> Send for OccupiedEntryRaw<StateApi> where
<StateApi as HasStateApi>::EntryType: Send,
impl<StateApi> Sync for OccupiedEntryRaw<StateApi> where
<StateApi as HasStateApi>::EntryType: Sync,
impl<StateApi> Unpin for OccupiedEntryRaw<StateApi> where
<StateApi as HasStateApi>::EntryType: Unpin,
impl<StateApi> UnwindSafe for OccupiedEntryRaw<StateApi> where
<StateApi as HasStateApi>::EntryType: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more