pub struct OccupiedEntry<'a, K, V: Serial, S: HasStateApi> { /* private fields */ }
Expand description

A view into an occupied entry in a StateMap. It can be obtained via the StateMap::entry method. This allows looking up or modifying the value at a give key in-place.

The type implements DerefMut which allows the value to be mutated. The Drop implementation ensures that the value is properly stored in the contract state maintained by the node.

This differs from OccupiedEntryRaw in that this automatically handles serialization and provides convenience methods for modifying the value via the DerefMut implementation.

Implementations

Get a reference to the key that is associated with this entry.

Get an immutable reference to the value contained in this entry.

Modify the value in the entry, and possibly return some information.

Like modify, but allows the closure to signal failure, aborting the update.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

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.