pub trait MemoryTransfer {
    // Required methods
    fn read(&self, source_addr: Pointer<u8>, size: usize) -> Result<Vec<u8>>;
    fn read_into(
        &self,
        source_addr: Pointer<u8>,
        destination: &mut [u8]
    ) -> Result<()>;
    fn write_from(&self, dest_addr: Pointer<u8>, source: &[u8]) -> Result<()>;
}
Expand description

Provides safe memory access interface using an external buffer

Required Methods§

source

fn read(&self, source_addr: Pointer<u8>, size: usize) -> Result<Vec<u8>>

Read data from a slice of memory into a newly allocated buffer.

Returns an error if the read would go out of the memory bounds.

source

fn read_into( &self, source_addr: Pointer<u8>, destination: &mut [u8] ) -> Result<()>

Read data from a slice of memory into a destination buffer.

Returns an error if the read would go out of the memory bounds.

source

fn write_from(&self, dest_addr: Pointer<u8>, source: &[u8]) -> Result<()>

Write data to a slice of memory.

Returns an error if the write would go out of the memory bounds.

Implementors§