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>

source

pub fn key(&self) -> &[u8]

Gets a reference to the key that would be used when inserting a value through the OccupiedEntryRaw.

source

pub fn get_ref(&self) -> &StateApi::EntryType

Gets a reference to the HasStateEntry type in the entry.

source

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.

source

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.

source

pub fn insert_raw(&mut self, value: &[u8])

Sets the value of the entry with the OccupiedEntryRaw’s key.

source

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> Freeze for OccupiedEntryRaw<StateApi>
where StateApi: Clone, <StateApi as HasStateApi>::EntryType: Freeze,

§

impl<StateApi> RefUnwindSafe for OccupiedEntryRaw<StateApi>
where StateApi: Clone, <StateApi as HasStateApi>::EntryType: RefUnwindSafe,

§

impl<StateApi> Send for OccupiedEntryRaw<StateApi>
where StateApi: Clone, <StateApi as HasStateApi>::EntryType: Send,

§

impl<StateApi> Sync for OccupiedEntryRaw<StateApi>
where StateApi: Clone, <StateApi as HasStateApi>::EntryType: Sync,

§

impl<StateApi> Unpin for OccupiedEntryRaw<StateApi>
where StateApi: Clone, <StateApi as HasStateApi>::EntryType: Unpin,

§

impl<StateApi> UnwindSafe for OccupiedEntryRaw<StateApi>
where StateApi: Clone, <StateApi as HasStateApi>::EntryType: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.