Skip to main content

MemoryTransfer

Trait MemoryTransfer 

Source
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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§