pub struct MemoryBackend<'vicinity> { /* private fields */ }Expand description
Memory backend, storing all state values in a BTreeMap in memory.
Implementations§
Source§impl<'vicinity> MemoryBackend<'vicinity>
impl<'vicinity> MemoryBackend<'vicinity>
Sourcepub fn new(
vicinity: &'vicinity MemoryVicinity,
state: BTreeMap<H160, MemoryAccount>,
) -> Self
pub fn new( vicinity: &'vicinity MemoryVicinity, state: BTreeMap<H160, MemoryAccount>, ) -> Self
Create a new memory backend.
Sourcepub fn state(&self) -> &BTreeMap<H160, MemoryAccount>
pub fn state(&self) -> &BTreeMap<H160, MemoryAccount>
Get the underlying BTreeMap storing the state.
Sourcepub fn state_mut(&mut self) -> &mut BTreeMap<H160, MemoryAccount>
pub fn state_mut(&mut self) -> &mut BTreeMap<H160, MemoryAccount>
Get a mutable reference to the underlying BTreeMap storing the state.
Trait Implementations§
Source§impl<'vicinity> ApplyBackend for MemoryBackend<'vicinity>
impl<'vicinity> ApplyBackend for MemoryBackend<'vicinity>
Source§fn apply<A, I, L>(&mut self, values: A, logs: L, delete_empty: bool)where
A: IntoIterator<Item = Apply<I>>,
I: IntoIterator<Item = (H256, H256)>,
L: IntoIterator<Item = Log>,
fn apply<A, I, L>(&mut self, values: A, logs: L, delete_empty: bool)where
A: IntoIterator<Item = Apply<I>>,
I: IntoIterator<Item = (H256, H256)>,
L: IntoIterator<Item = Log>,
Apply given values and logs at backend.
Source§impl<'vicinity> Backend for MemoryBackend<'vicinity>
impl<'vicinity> Backend for MemoryBackend<'vicinity>
Source§fn block_hash(&self, number: U256) -> H256
fn block_hash(&self, number: U256) -> H256
Environmental block hash.
Source§fn block_number(&self) -> U256
fn block_number(&self) -> U256
Environmental block number.
Source§fn block_coinbase(&self) -> H160
fn block_coinbase(&self) -> H160
Environmental coinbase.
Source§fn block_timestamp(&self) -> U256
fn block_timestamp(&self) -> U256
Environmental block timestamp.
Source§fn block_difficulty(&self) -> U256
fn block_difficulty(&self) -> U256
Environmental block difficulty.
Source§fn block_gas_limit(&self) -> U256
fn block_gas_limit(&self) -> U256
Environmental block gas limit.
Source§fn block_base_fee_per_gas(&self) -> U256
fn block_base_fee_per_gas(&self) -> U256
Environmental block base fee.
Source§impl<'vicinity> Clone for MemoryBackend<'vicinity>
impl<'vicinity> Clone for MemoryBackend<'vicinity>
Source§fn clone(&self) -> MemoryBackend<'vicinity>
fn clone(&self) -> MemoryBackend<'vicinity>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'vicinity> Freeze for MemoryBackend<'vicinity>
impl<'vicinity> RefUnwindSafe for MemoryBackend<'vicinity>
impl<'vicinity> Send for MemoryBackend<'vicinity>
impl<'vicinity> Sync for MemoryBackend<'vicinity>
impl<'vicinity> Unpin for MemoryBackend<'vicinity>
impl<'vicinity> UnwindSafe for MemoryBackend<'vicinity>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more