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

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

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

Performs the conversion.

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more