Struct sp_state_machine::TestExternalities
source · [−]pub struct TestExternalities<H: Hasher> where
H::Out: Codec + Ord, {
pub backend: InMemoryBackend<H>,
pub extensions: Extensions,
/* private fields */
}
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 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.
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.
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
Tries to find a registered extension and returns a mutable reference.
Register extension ext
. Read more
impl<H: Hasher> PartialEq<TestExternalities<H>> for TestExternalities<H> where
H::Out: Ord + 'static + Codec,
impl<H: Hasher> PartialEq<TestExternalities<H>> for TestExternalities<H> where
H::Out: Ord + 'static + Codec,
Auto Trait Implementations
impl<H> !RefUnwindSafe for TestExternalities<H>
impl<H> Send for TestExternalities<H>
impl<H> !Sync for TestExternalities<H>
impl<H> !UnwindSafe for TestExternalities<H>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘimpl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘimpl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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
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