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
impl<H: Hasher, N: ChangesTrieBlockNumber> TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
Get externalities implementation.
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.
pub fn execute_with_safe<R>(
&mut self,
f: impl FnOnce() -> R + UnwindSafe
) -> Result<R, String>
pub fn execute_with_safe<R>(
&mut self,
f: impl FnOnce() -> R + UnwindSafe
) -> Result<R, String>
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
impl<H: Hasher, N: ChangesTrieBlockNumber> Debug for TestExternalities<H, N> where
H::Out: Ord + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> Debug for TestExternalities<H, N> where
H::Out: Ord + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> Default for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> Default for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
impl<H, N> ExtensionStore for TestExternalities<H, N> where
H: Hasher,
H::Out: Ord + Codec,
N: ChangesTrieBlockNumber,
impl<H, N> ExtensionStore for TestExternalities<H, N> where
H: Hasher,
H::Out: Ord + Codec,
N: ChangesTrieBlockNumber,
impl<H, N> ExternalitiesExt for TestExternalities<H, N> where
H: Hasher,
H::Out: Ord + Codec,
N: ChangesTrieBlockNumber,
impl<H, N> ExternalitiesExt for TestExternalities<H, N> where
H: Hasher,
H::Out: Ord + Codec,
N: ChangesTrieBlockNumber,
Tries to find a registered extension and returns a mutable reference.
Register extension ext
. Read more
impl<H: Hasher, N: ChangesTrieBlockNumber> From<Storage> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> From<Storage> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> PartialEq<TestExternalities<H, N>> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> PartialEq<TestExternalities<H, N>> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
Auto Trait Implementations
impl<H, N = u64> !RefUnwindSafe for TestExternalities<H, N>
impl<H, N> Send for TestExternalities<H, N>
impl<H, N = u64> !Sync for TestExternalities<H, N>
impl<H, N> Unpin for TestExternalities<H, N> where
H: Unpin,
N: Unpin,
<H as Hasher>::Out: Unpin,
impl<H, N = u64> !UnwindSafe for TestExternalities<H, N>
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
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
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The counterpart to unchecked_from
.
pub fn vzip(self) -> V
impl<T> MaybeDebug for T where
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,