Struct sp_state_machine::TestExternalities [−][src]
Simple HashMap-based Externalities impl.
Implementations
impl<H: Hasher, N: ChangesTrieBlockNumber> TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]
H::Out: Ord + 'static + Codec,
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], mut 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]
H::Out: Ord + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> Default for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]
H::Out: Ord + 'static + Codec,
impl<H, N> ExtensionStore for TestExternalities<H, N> where
H: Hasher,
H::Out: Ord + Codec,
N: ChangesTrieBlockNumber,
[src]
H: Hasher,
H::Out: Ord + Codec,
N: ChangesTrieBlockNumber,
fn extension_by_type_id(&mut self, type_id: TypeId) -> Option<&mut dyn Any>
[src]
fn register_extension_with_type_id(
&mut self,
type_id: TypeId,
extension: Box<dyn Extension>
) -> Result<(), Error>
[src]
&mut self,
type_id: TypeId,
extension: Box<dyn Extension>
) -> Result<(), Error>
fn deregister_extension_by_type_id(
&mut self,
type_id: TypeId
) -> Result<(), Error>
[src]
&mut self,
type_id: TypeId
) -> Result<(), Error>
impl<H: Hasher, N: ChangesTrieBlockNumber> From<Storage> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]
H::Out: Ord + 'static + Codec,
impl<H: Hasher, N: ChangesTrieBlockNumber> PartialEq<TestExternalities<H, N>> for TestExternalities<H, N> where
H::Out: Ord + 'static + Codec,
[src]
H::Out: Ord + 'static + Codec,
Auto Trait Implementations
impl<H, N = u64> !RefUnwindSafe for TestExternalities<H, N>
[src]
impl<H, N> Send for TestExternalities<H, N>
[src]
impl<H, N = u64> !Sync for TestExternalities<H, N>
[src]
impl<H, N> Unpin for TestExternalities<H, N> where
H: Unpin,
N: Unpin,
<H as Hasher>::Out: Unpin,
[src]
H: Unpin,
N: Unpin,
<H as Hasher>::Out: Unpin,
impl<H, N = u64> !UnwindSafe for TestExternalities<H, N>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> 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, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
pub fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
pub fn from_mut(outer: &mut Outer) -> &mut T
[src]
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,