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

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

Types that support raw volatile access to their data.

Required methods

pub fn len(&self) -> usize

Gets the size of this slice.

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

Returns a VolatileSlice of count bytes starting at offset.

Loading content...

Provided methods

pub fn is_empty(&self) -> bool

Check whether the region is empty.

pub fn as_volatile_slice(&self) -> VolatileSlice<'_>

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

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

Gets a VolatileRef at offset.

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

Returns a VolatileArrayRef of n elements starting at offset.

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

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

pub fn get_atomic_ref<T: AtomicInteger>(&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.

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