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 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
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
Converts self into T using Into<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
Causes self to use its Binary implementation when Debug-formatted. Read more
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted. Read more
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. 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.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
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
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
Attempts to convert self into T using TryInto<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.
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