Struct oasis_runtime_sdk::state::StateValue
source · pub struct StateValue<'a, V> { /* private fields */ }
Expand description
A per-state arbitrary value.
Implementations§
source§impl<'a, V: Any> StateValue<'a, V>
impl<'a, V: Any> StateValue<'a, V>
sourcepub fn get(self) -> Option<&'a V>
pub fn get(self) -> Option<&'a V>
Gets a reference to the specified per-state value.
§Panics
Panics if the retrieved type is not the type that was stored.
sourcepub fn get_mut(&mut self) -> Option<&mut V>
pub fn get_mut(&mut self) -> Option<&mut V>
Gets a mutable reference to the specified per-state value.
§Panics
Panics if the retrieved type is not the type that was stored.
source§impl<'a, V: Any + Default> StateValue<'a, V>
impl<'a, V: Any + Default> StateValue<'a, V>
sourcepub fn or_default(self) -> &'a mut V
pub fn or_default(self) -> &'a mut V
Retrieves the existing value or inserts and returns the default.
§Panics
Panics if the retrieved type is not the type that was stored.
Auto Trait Implementations§
impl<'a, V> Freeze for StateValue<'a, V>
impl<'a, V> !RefUnwindSafe for StateValue<'a, V>
impl<'a, V> !Send for StateValue<'a, V>
impl<'a, V> !Sync for StateValue<'a, V>
impl<'a, V> Unpin for StateValue<'a, V>where
V: Unpin,
impl<'a, V> !UnwindSafe for StateValue<'a, V>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more