Struct sp_state_machine::TestExternalities [−][src]
pub struct TestExternalities<H: Hasher, N: ChangesTrieBlockNumber = u64> where
H::Out: Codec + Ord, { /* fields omitted */ }
Simple HashMap-based Externalities impl.
Implementations
impl<H: Hasher, N: ChangesTrieBlockNumber> TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]
impl<H: Hasher, N: ChangesTrieBlockNumber> TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]pub fn ext(&mut self) -> Ext<'_, H, N, InMemoryBackend<H>>
[src]
Get externalities implementation.
pub fn new(storage: Storage) -> Self
[src]
Create a new instance of TestExternalities
with storage.
pub fn new_empty() -> Self
[src]
New empty test externalities.
pub fn new_with_code(code: &[u8], storage: Storage) -> Self
[src]
Create a new instance of TestExternalities
with code and storage.
pub fn overlayed_changes(&self) -> &OverlayedChanges
[src]
Returns the overlayed changes.
pub fn persist_offchain_overlay(&mut self)
[src]
Move offchain changes from overlay to the persistent store.
pub fn offchain_db(&self) -> TestPersistentOffchainDB
[src]
A shared reference type around the offchain worker storage.
pub fn insert(&mut self, k: StorageKey, v: StorageValue)
[src]
Insert key/value into backend
pub fn register_extension<E: Any + Extension>(&mut self, ext: E)
[src]
Registers the given extension for this instance.
pub fn changes_trie_storage(&mut self) -> &mut ChangesTrieInMemoryStorage<H, N>
[src]
Get mutable reference to changes trie storage.
pub fn commit_all(&mut self) -> Result<(), String>
[src]
Commit all pending changes to the underlying backend.
Panic
This will panic if there are still open transactions.
pub fn execute_with<R>(&mut self, execute: impl FnOnce() -> R) -> R
[src]
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>
[src]
&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,
[src]
impl<H: Hasher, N: ChangesTrieBlockNumber> Debug for TestExternalities<H, N> where
H::Out: Ord + Codec,
[src]impl<H: Hasher, N: ChangesTrieBlockNumber> Default for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]
impl<H: Hasher, N: ChangesTrieBlockNumber> Default for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]impl<H, N> ExtensionStore for TestExternalities<H, N> where
H: Hasher,
H::Out: Ord + Codec,
N: ChangesTrieBlockNumber,
[src]
impl<H, N> ExtensionStore for TestExternalities<H, N> where
H: Hasher,
H::Out: Ord + Codec,
N: ChangesTrieBlockNumber,
[src]impl<H: Hasher, N: ChangesTrieBlockNumber> From<Storage> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]
impl<H: Hasher, N: ChangesTrieBlockNumber> From<Storage> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]impl<H: Hasher, N: ChangesTrieBlockNumber> PartialEq<TestExternalities<H, N>> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]
impl<H: Hasher, N: ChangesTrieBlockNumber> PartialEq<TestExternalities<H, N>> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]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,
H: Unpin,
N: Unpin,
<H as Hasher>::Out: Unpin,
impl<H, N = u64> !UnwindSafe for TestExternalities<H, N>
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]pub fn unchecked_into(self) -> T
[src]
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,