MemoryBackend

Struct MemoryBackend 

Source
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>

Source

pub fn new( vicinity: &'vicinity MemoryVicinity, state: BTreeMap<H160, MemoryAccount>, ) -> Self

Create a new memory backend.

Source

pub fn state(&self) -> &BTreeMap<H160, MemoryAccount>

Get the underlying BTreeMap storing the state.

Source

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>

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>,

Apply given values and logs at backend.
Source§

impl<'vicinity> Backend for MemoryBackend<'vicinity>

Source§

fn gas_price(&self) -> U256

Gas price. Unused for London.
Source§

fn gas_left(&self) -> U256

Ges left
Source§

fn origin(&self) -> H160

Origin.
Source§

fn block_hash(&self, number: U256) -> H256

Environmental block hash.
Source§

fn block_number(&self) -> U256

Environmental block number.
Source§

fn block_coinbase(&self) -> H160

Environmental coinbase.
Source§

fn block_timestamp(&self) -> U256

Environmental block timestamp.
Source§

fn block_difficulty(&self) -> U256

Environmental block difficulty.
Source§

fn block_gas_limit(&self) -> U256

Environmental block gas limit.
Source§

fn block_base_fee_per_gas(&self) -> U256

Environmental block base fee.
Source§

fn chain_id(&self) -> U256

Environmental chain ID.
Source§

fn exists(&self, address: H160) -> bool

Whether account at address exists.
Source§

fn basic(&self, address: H160) -> Basic

Get basic account information.
Source§

fn code(&self, address: H160) -> Vec<u8>

Get account code.
Source§

fn storage(&self, address: H160, index: H256) -> H256

Get storage value of address at index.
Source§

fn original_storage(&self, address: H160, index: H256) -> Option<H256>

Get original storage value of address at index, if available.
Source§

impl<'vicinity> Clone for MemoryBackend<'vicinity>

Source§

fn clone(&self) -> MemoryBackend<'vicinity>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'vicinity> Debug for MemoryBackend<'vicinity>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> MaybeDebug for T