Trait MemoryReadable

Source
pub trait MemoryReadable<Store: Store> {
    // Required methods
    fn read_byte(
        &self,
        store: &mut <Store as Store>::ActualStore<'_>,
        offset: u32,
    ) -> u8;
    fn read_array<const COUNT: usize>(
        &self,
        store: &mut <Store as Store>::ActualStore<'_>,
        offset: u32,
    ) -> [u8; COUNT];
    fn read_vec(
        &self,
        store: &mut <Store as Store>::ActualStore<'_>,
        offset: u32,
        size: u32,
    ) -> Vec<u8> ;
}

Required Methods§

Source

fn read_byte( &self, store: &mut <Store as Store>::ActualStore<'_>, offset: u32, ) -> u8

This function will panic if the offset is out of bounds. It is caller’s responsibility to check if the offset is in bounds using MemoryView::check_bounds function

Source

fn read_array<const COUNT: usize>( &self, store: &mut <Store as Store>::ActualStore<'_>, offset: u32, ) -> [u8; COUNT]

This function will panic if [offset..offset + COUNT] is out of bounds. It is caller’s responsibility to check if the offset is in bounds using MemoryView::check_bounds function.

Source

fn read_vec( &self, store: &mut <Store as Store>::ActualStore<'_>, offset: u32, size: u32, ) -> Vec<u8>

This function will panic if [offset..offset + size] is out of bounds. It is caller’s responsibility to check if the offset is in bounds using MemoryView::check_bounds function.

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.

Implementors§