guestmem

Trait MemoryRead

Source
pub trait MemoryRead {
    // Required methods
    fn read(&mut self, data: &mut [u8]) -> Result<&mut Self, AccessError>;
    fn skip(&mut self, len: usize) -> Result<&mut Self, AccessError>;
    fn len(&self) -> usize;

    // Provided methods
    fn read_plain<T: AsBytes + FromBytes>(&mut self) -> Result<T, AccessError> { ... }
    fn read_n<T: AsBytes + FromBytes + Copy>(
        &mut self,
        len: usize,
    ) -> Result<Vec<T>, AccessError> { ... }
    fn read_all(&mut self) -> Result<Vec<u8>, AccessError> { ... }
    fn limit(self, len: usize) -> Limit<Self>
       where Self: Sized { ... }
}

Required Methods§

Source

fn read(&mut self, data: &mut [u8]) -> Result<&mut Self, AccessError>

Source

fn skip(&mut self, len: usize) -> Result<&mut Self, AccessError>

Source

fn len(&self) -> usize

Provided Methods§

Source

fn read_plain<T: AsBytes + FromBytes>(&mut self) -> Result<T, AccessError>

Source

fn read_n<T: AsBytes + FromBytes + Copy>( &mut self, len: usize, ) -> Result<Vec<T>, AccessError>

Source

fn read_all(&mut self) -> Result<Vec<u8>, AccessError>

Source

fn limit(self, len: usize) -> Limit<Self>
where Self: Sized,

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 MemoryRead for &[u8]

Source§

fn read(&mut self, data: &mut [u8]) -> Result<&mut Self, AccessError>

Source§

fn skip(&mut self, len: usize) -> Result<&mut Self, AccessError>

Source§

fn len(&self) -> usize

Implementors§