[][src]Trait vm_memory::volatile_memory::VolatileMemory

pub trait VolatileMemory {
    fn len(&self) -> usize;
fn get_slice(&self, offset: usize, count: usize) -> Result<VolatileSlice>; fn is_empty(&self) -> bool { ... }
fn as_volatile_slice(&self) -> VolatileSlice { ... }
fn get_ref<T: ByteValued>(&self, offset: usize) -> Result<VolatileRef<T>> { ... }
fn get_array_ref<T: ByteValued>(
        &self,
        offset: usize,
        n: usize
    ) -> Result<VolatileArrayRef<T>> { ... }
unsafe fn aligned_as_ref<T: ByteValued>(&self, offset: usize) -> Result<&T> { ... }
unsafe fn aligned_as_mut<T: ByteValued>(
        &self,
        offset: usize
    ) -> Result<&mut T> { ... }
fn get_atomic_ref<T: AtomicValued>(&self, offset: usize) -> Result<&T> { ... }
fn compute_end_offset(&self, base: usize, offset: usize) -> Result<usize> { ... } }

Types that support raw volatile access to their data.

Required methods

fn len(&self) -> usize

Gets the size of this slice.

fn get_slice(&self, offset: usize, count: usize) -> Result<VolatileSlice>

Returns a VolatileSlice of count bytes starting at offset.

Loading content...

Provided methods

fn is_empty(&self) -> bool

Check whether the region is empty.

fn as_volatile_slice(&self) -> VolatileSlice

Gets a slice of memory for the entire region that supports volatile access.

fn get_ref<T: ByteValued>(&self, offset: usize) -> Result<VolatileRef<T>>

Gets a VolatileRef at offset.

fn get_array_ref<T: ByteValued>(
    &self,
    offset: usize,
    n: usize
) -> Result<VolatileArrayRef<T>>

Returns a VolatileArrayRef of n elements starting at offset.

unsafe fn aligned_as_ref<T: ByteValued>(&self, offset: usize) -> Result<&T>

Returns a reference to an instance of T at offset.

Safety

To use this safely, the caller must guarantee that there are no other users of the given chunk of memory for the lifetime of the result.

Errors

If the resulting pointer is not aligned, this method will return an Error.

unsafe fn aligned_as_mut<T: ByteValued>(&self, offset: usize) -> Result<&mut T>

Returns a mutable reference to an instance of T at offset.

Safety

To use this safely, the caller must guarantee that there are no other users of the given chunk of memory for the lifetime of the result.

Errors

If the resulting pointer is not aligned, this method will return an Error.

fn get_atomic_ref<T: AtomicValued>(&self, offset: usize) -> Result<&T>

Returns a reference to an instance of T at offset.

Errors

If the resulting pointer is not aligned, this method will return an Error.

fn compute_end_offset(&self, base: usize, offset: usize) -> Result<usize>

Returns the sum of base and offset if the resulting address is valid.

Loading content...

Implementations on Foreign Types

impl<'a> VolatileMemory for &'a mut [u8][src]

Loading content...

Implementors

impl<'_> VolatileMemory for VolatileSlice<'_>[src]

Loading content...