Struct Machine

Source
pub struct Machine<S> {
    pub retval: Vec<u8>,
    pub memory: Memory,
    pub stack: Stack,
    pub state: S,
    /* private fields */
}
Expand description

Core execution layer for EVM.

Fields§

§retval: Vec<u8>

Return value. Note the difference between retbuf. A retval holds what’s returned by the current machine, with RETURN or REVERT opcode. A retbuf holds the buffer of returned value by sub-calls.

§memory: Memory

Memory.

§stack: Stack

Stack.

§state: S

Extra state,

Implementations§

Source§

impl<S> Machine<S>

Source

pub fn new( code: Rc<Vec<u8>>, data: Rc<Vec<u8>>, stack_limit: usize, memory_limit: usize, state: S, ) -> Self

Create a new machine with given code and data.

Source

pub fn code(&self) -> &[u8]

Machine code.

Source

pub fn is_empty(&self) -> bool

Whether the machine has empty code.

Trait Implementations§

Source§

impl<'etable, S, ES> AsMut<Machine<S>> for EtableInterpreter<'etable, S, ES>

Source§

fn as_mut(&mut self) -> &mut Machine<S>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<'etable, S, ES> AsRef<Machine<S>> for EtableInterpreter<'etable, S, ES>

Source§

fn as_ref(&self) -> &Machine<S>

Converts this type into a shared reference of the (usually inferred) input type.

Auto Trait Implementations§

§

impl<S> Freeze for Machine<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for Machine<S>
where S: RefUnwindSafe,

§

impl<S> !Send for Machine<S>

§

impl<S> !Sync for Machine<S>

§

impl<S> Unpin for Machine<S>
where S: Unpin,

§

impl<S> UnwindSafe for Machine<S>
where S: UnwindSafe,

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> 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> TrapConsume<T> for T

Source§

type Rest = Infallible

Rest type.
Source§

fn consume(self) -> Result<T, Infallible>

Consume T to get Rest.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V