Struct sp_state_machine::TestExternalities [−][src]
pub struct TestExternalities<H: Hasher> 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 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
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.
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 occurred.
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
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
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
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
The counterpart to unchecked_from
.
pub fn vzip(self) -> V
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