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

Get a shared reference to the value. Note that StateRefMut also implements Deref so this conversion can happen implicitly.

Get a unique reference to the value. Note that StateRefMut also implements DerefMut so this conversion can happen implicitly.

Set the value. Overwrites the existing one.

Update the existing value with the given function.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

When dropped, the value, V, is written to the entry in the contract state.

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.