Skip to main content

StepSnapshot

Struct StepSnapshot 

Source
pub struct StepSnapshot {
    pub stack: Vec<Word>,
    pub memory: Option<Bytes>,
    pub storage: Arc<BTreeMap<String, String>>,
    pub storage_diff: BTreeMap<String, StorageChange>,
    pub transient_storage: BTreeMap<String, String>,
    pub return_data: Option<Arc<str>>,
}
Expand description

The machine state one step captured.

memory and storage are shared: a backend building steps hands the previous step’s value on unchanged, so a trace holds one copy of memory per change rather than one per step. Reads see plain values through Deref; a step that changes them gets its own.

Memory is held as bytes. Trace files spell it as one unprefixed lowercase hex string, and serialization writes and reads that spelling, so the bytes are only a change in how a step holds memory, not in what a file says.

Fields§

§stack: Vec<Word>§memory: Option<Bytes>

Memory as bytes. A Bytes clone shares the buffer, which is how consecutive steps hold one copy of unchanged memory.

§storage: Arc<BTreeMap<String, String>>§storage_diff: BTreeMap<String, StorageChange>§transient_storage: BTreeMap<String, String>

The transient slots this step read or wrote, with their value after it.

§return_data: Option<Arc<str>>

The return data buffer before this step, as unprefixed hex; None when empty.

Implementations§

Source§

impl StepSnapshot

Source

pub fn new( stack: Vec<Word>, memory: Option<Bytes>, storage: BTreeMap<String, String>, storage_diff: BTreeMap<String, StorageChange>, ) -> Self

A snapshot that owns its values, for a backend or a test building one from parts.

Source

pub fn with_transient_storage( self, transient_storage: BTreeMap<String, String>, ) -> Self

The same snapshot with transient_storage set.

Source

pub fn with_return_data(self, return_data: Option<String>) -> Self

The same snapshot with return_data set; empty data is stored as None.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Clone for StepSnapshot

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for StepSnapshot

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for StepSnapshot

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for StepSnapshot

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for StepSnapshot

Source§

impl PartialEq for StepSnapshot

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for StepSnapshot

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for StepSnapshot

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.