pub trait Access<'a> {
    type Error: Display;

    // Required methods
    fn get_reg(&self, reg: Reg) -> u32;
    fn set_reg(&mut self, reg: Reg, value: u32);
    fn read_memory_into_slice<'slice, T>(
        &self,
        address: u32,
        buffer: &'slice mut T
    ) -> Result<&'slice mut [u8], Self::Error>
       where T: ?Sized + AsUninitSliceMut;
    fn write_memory(
        &mut self,
        address: u32,
        data: &[u8]
    ) -> Result<(), Self::Error>;
    fn sbrk(&mut self, size: u32) -> Option<u32>;
    fn heap_size(&self) -> u32;
    fn program_counter(&self) -> Option<u32>;
    fn native_program_counter(&self) -> Option<u64>;
    fn gas_remaining(&self) -> Option<Gas>;
    fn consume_gas(&mut self, gas: u64);
}

Required Associated Types§

Required Methods§

source

fn get_reg(&self, reg: Reg) -> u32

source

fn set_reg(&mut self, reg: Reg, value: u32)

source

fn read_memory_into_slice<'slice, T>( &self, address: u32, buffer: &'slice mut T ) -> Result<&'slice mut [u8], Self::Error>
where T: ?Sized + AsUninitSliceMut,

source

fn write_memory(&mut self, address: u32, data: &[u8]) -> Result<(), Self::Error>

source

fn sbrk(&mut self, size: u32) -> Option<u32>

source

fn heap_size(&self) -> u32

Returns the current size of the program’s heap.

source

fn program_counter(&self) -> Option<u32>

source

fn native_program_counter(&self) -> Option<u64>

source

fn gas_remaining(&self) -> Option<Gas>

Gets the amount of gas remaining, or None if gas metering is not enabled for this instance.

Note that this being zero doesn’t necessarily mean that the execution ran out of gas, if the program ended up consuming exactly the amount of gas that it was provided with!

source

fn consume_gas(&mut self, gas: u64)

Object Safety§

This trait is not object safe.

Implementors§