pub struct TestExternalities<H>where
    H: Hasher + 'static,
    H::Out: Codec + Ord,
{ pub backend: InMemoryBackend<H>, pub extensions: Extensions, pub state_version: StateVersion, /* private fields */ }
Expand description

Simple HashMap-based Externalities impl.

Fields

backend: InMemoryBackend<H>

Storage backend.

extensions: Extensions

Extensions.

state_version: StateVersion

State version to use during tests.

Implementations

Get externalities implementation.

Create a new instance of TestExternalities with storage.

Create a new instance of TestExternalities with storage for a given state version.

New empty test externalities.

Create a new instance of TestExternalities with code and storage.

Create a new instance of TestExternalities with code and storage for a given state version.

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

Insert key/value into backend.

This only supports inserting keys in child tries.

Registers the given extension for this instance.

Return a new backend with all pending changes.

In contrast to commit_all this will not panic if there are open transactions.

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, with proving_backend as backend, is set as externalities.

This implementation will wipe the proof recorded in between calls. Consecutive calls will get their own proof from scratch.

Execute the given closure while self is set as externalities.

Returns the result of the given closure, if no panics occurred. 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 specified ‘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
Converts to this type from the input type.
Converts to this type from the input type.

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 !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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 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

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.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
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.
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