Struct concordium_std::StateRefMut
source · pub struct StateRefMut<'a, V: Serial, S: HasStateApi> { /* private fields */ }
Expand description
The StateRefMut<_, V, _>
behaves like &mut V
, by analogy with other
standard library RAII guards like RefMut
.
The type implements DerefMut
which allows the
value to be mutated. Additionally, the Drop
implementation ensures
that the value is properly stored in the contract state maintained by the
node.
Implementations§
source§impl<'a, V, S> StateRefMut<'a, V, S>
impl<'a, V, S> StateRefMut<'a, V, S>
sourcepub fn get(&self) -> &V
pub fn get(&self) -> &V
Get a shared reference to the value. Note that StateRefMut also implements Deref so this conversion can happen implicitly.
sourcepub fn get_mut(&mut self) -> &mut V
pub fn get_mut(&mut self) -> &mut V
Get a unique reference to the value. Note that StateRefMut also implements DerefMut so this conversion can happen implicitly.
Trait Implementations§
source§impl<'a, V: Debug + Serial, S: Debug + HasStateApi> Debug for StateRefMut<'a, V, S>
impl<'a, V: Debug + Serial, S: Debug + HasStateApi> Debug for StateRefMut<'a, V, S>
source§impl<'a, S: HasStateApi, V: Serial + DeserialWithState<S>> Deref for StateRefMut<'a, V, S>
impl<'a, S: HasStateApi, V: Serial + DeserialWithState<S>> Deref for StateRefMut<'a, V, S>
source§impl<'a, S: HasStateApi, V: Serial + DeserialWithState<S>> DerefMut for StateRefMut<'a, V, S>
impl<'a, S: HasStateApi, V: Serial + DeserialWithState<S>> DerefMut for StateRefMut<'a, V, S>
source§impl<'a, V: Serial, S: HasStateApi> Drop for StateRefMut<'a, V, S>
impl<'a, V: Serial, S: HasStateApi> Drop for StateRefMut<'a, V, S>
When dropped, the value, V
, is written to the entry in the contract state.
Auto Trait Implementations§
impl<'a, V, S> !RefUnwindSafe for StateRefMut<'a, V, S>
impl<'a, V, S> Send for StateRefMut<'a, V, S>
impl<'a, V, S> !Sync for StateRefMut<'a, V, S>
impl<'a, V, S> Unpin for StateRefMut<'a, V, S>
impl<'a, V, S> !UnwindSafe for StateRefMut<'a, V, S>
Blanket Implementations§
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