Struct ckb_vm::machine::DefaultMachine

source ·
pub struct DefaultMachine<Inner> { /* private fields */ }

Implementations§

source§

impl<Inner: SupportMachine> DefaultMachine<Inner>

source

pub fn load_program( &mut self, program: &Bytes, args: &[Bytes], ) -> Result<u64, Error>

source

pub fn load_program_with_metadata( &mut self, program: &Bytes, metadata: &ProgramMetadata, args: &[Bytes], ) -> Result<u64, Error>

source

pub fn take_inner(self) -> Inner

source

pub fn pause(&self) -> Pause

source

pub fn set_pause(&mut self, pause: Pause)

source

pub fn exit_code(&self) -> i8

source

pub fn instruction_cycle_func(&self) -> &InstructionCycleFunc

source

pub fn inner_mut(&mut self) -> &mut Inner

source

pub fn run(&mut self) -> Result<i8, Error>

source

pub fn step(&mut self, decoder: &mut Decoder) -> Result<(), Error>

Trait Implementations§

source§

impl<Inner: CoreMachine> CoreMachine for DefaultMachine<Inner>

§

type REG = <Inner as CoreMachine>::REG

§

type MEM = <Inner as CoreMachine>::MEM

source§

fn pc(&self) -> &Self::REG

source§

fn update_pc(&mut self, pc: Self::REG)

source§

fn commit_pc(&mut self)

source§

fn memory(&self) -> &Self::MEM

source§

fn memory_mut(&mut self) -> &mut Self::MEM

source§

fn registers(&self) -> &[Self::REG]

source§

fn set_register(&mut self, idx: usize, value: Self::REG)

source§

fn isa(&self) -> u8

source§

fn version(&self) -> u32

source§

impl<Inner: CoreMachine> Display for DefaultMachine<Inner>

source§

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

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

impl<Inner: SupportMachine> Machine for DefaultMachine<Inner>

source§

fn ecall(&mut self) -> Result<(), Error>

source§

fn ebreak(&mut self) -> Result<(), Error>

source§

impl<Inner: SupportMachine> SupportMachine for DefaultMachine<Inner>

source§

fn cycles(&self) -> u64

source§

fn set_cycles(&mut self, cycles: u64)

source§

fn max_cycles(&self) -> u64

source§

fn set_max_cycles(&mut self, max_cycles: u64)

source§

fn reset(&mut self, max_cycles: u64)

source§

fn reset_signal(&mut self) -> bool

source§

fn running(&self) -> bool

source§

fn set_running(&mut self, running: bool)

source§

fn load_binary( &mut self, program: &Bytes, metadata: &ProgramMetadata, update_pc: bool, ) -> Result<u64, Error>

source§

fn load_elf(&mut self, program: &Bytes, update_pc: bool) -> Result<u64, Error>

source§

fn add_cycles(&mut self, cycles: u64) -> Result<(), Error>

source§

fn add_cycles_no_checking(&mut self, cycles: u64) -> Result<(), Error>

source§

fn load_elf_inner( &mut self, program: &Bytes, update_pc: bool, ) -> Result<u64, Error>

source§

fn load_binary_inner( &mut self, program: &Bytes, metadata: &ProgramMetadata, update_pc: bool, ) -> Result<u64, Error>

source§

fn initialize_stack( &mut self, args: &[Bytes], stack_start: u64, stack_size: u64, ) -> Result<u64, Error>

Auto Trait Implementations§

§

impl<Inner> Freeze for DefaultMachine<Inner>
where Inner: Freeze,

§

impl<Inner> !RefUnwindSafe for DefaultMachine<Inner>

§

impl<Inner> Send for DefaultMachine<Inner>
where Inner: Send,

§

impl<Inner> Sync for DefaultMachine<Inner>
where Inner: Sync,

§

impl<Inner> Unpin for DefaultMachine<Inner>
where Inner: Unpin,

§

impl<Inner> !UnwindSafe for DefaultMachine<Inner>

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.