revm_interpreter::interpreter_types

Trait MemoryTrait

Source
pub trait MemoryTrait {
    // Required methods
    fn set_data(
        &mut self,
        memory_offset: usize,
        data_offset: usize,
        len: usize,
        data: &[u8],
    );
    fn set(&mut self, memory_offset: usize, data: &[u8]);
    fn size(&self) -> usize;
    fn copy(&mut self, destination: usize, source: usize, len: usize);
    fn slice(&self, range: Range<usize>) -> impl Deref<Target = [u8]> + '_;
    fn resize(&mut self, new_size: usize) -> bool;

    // Provided method
    fn slice_len(
        &self,
        offset: usize,
        len: usize,
    ) -> impl Deref<Target = [u8]> + '_ { ... }
}

Required Methods§

Source

fn set_data( &mut self, memory_offset: usize, data_offset: usize, len: usize, data: &[u8], )

Source

fn set(&mut self, memory_offset: usize, data: &[u8])

Source

fn size(&self) -> usize

Source

fn copy(&mut self, destination: usize, source: usize, len: usize)

Source

fn slice(&self, range: Range<usize>) -> impl Deref<Target = [u8]> + '_

Memory slice with range.

§Panics

Panics if range is out of scope of allocated memory.

Source

fn resize(&mut self, new_size: usize) -> bool

Resize memory to new size.

§Note

It checks memory limits.

Provided Methods§

Source

fn slice_len(&self, offset: usize, len: usize) -> impl Deref<Target = [u8]> + '_

Memory slice len

Uses MemoryTrait::slice internally.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: MemoryGetter> MemoryTrait for Rc<RefCell<T>>

Source§

fn set_data( &mut self, memory_offset: usize, data_offset: usize, len: usize, data: &[u8], )

Source§

fn set(&mut self, memory_offset: usize, data: &[u8])

Source§

fn size(&self) -> usize

Source§

fn copy(&mut self, destination: usize, source: usize, len: usize)

Source§

fn slice(&self, range: Range<usize>) -> impl Deref<Target = [u8]> + '_

Source§

fn resize(&mut self, new_size: usize) -> bool

Implementors§