Struct evm_core::Machine

source ·
pub struct Machine { /* private fields */ }
Expand description

Core execution layer for EVM.

Implementations§

source§

impl Machine

source

pub fn stack(&self) -> &Stack

Reference of machine stack.

source

pub fn stack_mut(&mut self) -> &mut Stack

Mutable reference of machine stack.

source

pub fn memory(&self) -> &Memory

Reference of machine memory.

source

pub fn memory_mut(&mut self) -> &mut Memory

Mutable reference of machine memory.

source

pub fn position(&self) -> &Result<usize, ExitReason>

Return a reference of the program counter.

source

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

Create a new machine with given code and data.

source

pub fn exit(&mut self, reason: ExitReason)

Explicit exit of the machine. Further step will return error.

source

pub fn inspect(&self) -> Option<(Opcode, &Stack)>

Inspect the machine’s next opcode and current stack.

source

pub fn return_value(&self) -> Vec<u8>

Copy and get the return value of the machine, if any.

source

pub fn run(&mut self) -> Capture<ExitReason, Trap>

Loop stepping the machine, until it stops.

source

pub fn step(&mut self) -> Result<(), Capture<ExitReason, Trap>>

Step the machine, executing one opcode. It then returns.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V