pub struct StorageMapShim<S, L, K, T>(_);
Expand description

A shim for placing around a storage item in order to use it as a StoredValue. Ideally this wouldn’t be needed as StorageValues should blanket implement StoredValues, however this would break the ability to have custom impls of StoredValue. The other workaround is to implement it directly in the macro.

This form has the advantage that two additional types are provides, Created and Removed, which are both generic events that can be tied to handlers to do something in the case of being about to create an account where one didn’t previously exist (at all; not just where it used to be the default value), or where the account is being removed or reset back to the default value where previously it did exist (though may have been in a default state). This works well with system module’s CallOnCreatedAccount and CallKillAccount.

Trait Implementations

Get the item, or its default if it doesn’t yet exist; we make no distinction between the two. Read more

Set the item to something new.

Remove the item or otherwise replace it with its default value; we don’t care which.

Mutate the item.

Mutate the item, removing or resetting to default value if it has been mutated to None. Read more

Maybe mutate the item only if an Ok value is returned from f. Do nothing if an Err is returned. It is removed or reset to default value if it has been mutated to None 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

Convert from a value of T into an equivalent instance of Option<Self>. Read more

Consume self to return Some equivalent value of Option<T>. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Cast reference.

Cast reference.

Cast mutable reference.

Cast mutable reference.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Should always be Self

Convert from a value of T into an equivalent instance of Self. Read more

Consume self to return an equivalent value of T. Read more

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.

The counterpart to unchecked_from.

Consume self to return an equivalent value of T.