pub struct TestStateApi { /* private fields */ }
Expand description

A state api used for testing. Implements HasStateApi.

Implementations§

Create a new empty state.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
source§

fn create_entry(&mut self, key: &[u8]) -> Result<Self::EntryType, StateError>

Create a new entry in the state. If an entry with the given key already exists then it is reset to an empty entry. If the part of the tree where the key points to is locked due to an acquired iterator then no entry is created, and an error will be returned. Read more
source§

fn lookup_entry(&self, key: &[u8]) -> Option<Self::EntryType>

Lookup an entry in the state.
source§

fn delete_entry(&mut self, entry: Self::EntryType) -> Result<(), StateError>

Delete an entry. Returns an error if the entry did not exist, or if it is part of a locked subtree. Read more
Delete the entire subtree. Returns whether any values were deleted, or an error if the given prefix is part of a locked subtree. Read more
Get an iterator over a map in the state. Read more
Delete an iterator. See the iterator method for why this is necessary. Read more
Like lookup_entry except that it consumes the key and returns an EntryRaw instead of an optional entry. Read more
Read and deserialize the state stored at the root of the state trie. If such a state does not exist, or cannot be deserialized into the provided type, then this returns an error. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.