Struct sp_state_machine::TestExternalities[][src]

pub struct TestExternalities<H: Hasher, N: ChangesTrieBlockNumber = u64> where
    H::Out: Codec + Ord
{ pub backend: InMemoryBackend<H>, pub extensions: Extensions, // some fields omitted }
Expand description

Simple HashMap-based Externalities impl.

Fields

backend: InMemoryBackend<H>

Storage backend.

extensions: Extensions

Extensions.

Implementations

Get externalities implementation.

Create a new instance of TestExternalities with storage.

New empty test externalities.

Create a new instance of TestExternalities with code and storage.

Returns the overlayed changes.

Move offchain changes from overlay to the persistent store.

A shared reference type around the offchain worker storage.

Insert key/value into backend

Registers the given extension for this instance.

Get mutable reference to changes trie storage.

Commit all pending changes to the underlying backend.

Panic

This will panic if there are still open transactions.

Execute the given closure while self is set as externalities.

Returns the result of the given closure.

Execute the given closure while self is set as externalities.

Returns the result of the given closure, if no panics occured. Otherwise, returns Err.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Tries to find a registered extension by the given type_id and returns it as a &mut dyn Any. Read more

Register extension extension with specified type_id. Read more

Deregister extension with speicifed ‘type_id’ and drop it. Read more

Tries to find a registered extension and returns a mutable reference.

Register extension ext. Read more

Deregister and drop extension of T type. Read more

Performs the conversion.

This doesn’t test if they are in the same state, only if they contains the same data at this state

This method tests for !=.

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 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

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.