Skip to main content

CachedVmoMemory

Struct CachedVmoMemory 

Source
pub struct CachedVmoMemory(/* private fields */);
Expand description

A wrapper around VmoMemory guaranteed to be mapped with cached memory policy.

Implementations§

Source§

impl CachedVmoMemory

Source

pub unsafe fn new_unchecked(inner: VmoMemory) -> Self

Creates a new cached vmo memory from mapped memory.

§Safety

The caller must ensure that the mapped VMO is mapped with zx::CachePolicy::Cached.

Source

pub fn get(&self) -> &VmoMemory

Returns the contained mapped VMO.

Source

pub fn map( offset: usize, size: usize, vmo: Vmo, ) -> Result<MmioRegion<Self>, Status>

Maps vmo at offset with size ensuring the correct cache policy.

Source

pub fn new_mapped(size: usize) -> Result<MmioRegion<Self>, Status>

Creates a new VMO of size bytes and maps it into memory with cached cache policy.

Trait Implementations§

Source§

impl UnsafeMmio for CachedVmoMemory

Source§

fn len(&self) -> usize

Returns the size, in bytes, of the underlying MMIO region that can be accessed through this object.
Source§

fn align_offset(&self, align: usize) -> usize

Returns the first offset into this MMIO region that is suitably aligned foralign. Read more
Source§

unsafe fn load8_unchecked(&self, offset: usize) -> u8

Loads a u8 from this MMIO region at the given offset. Read more
Source§

unsafe fn load16_unchecked(&self, offset: usize) -> u16

Loads a u16 from this MMIO region at the given offset. Read more
Source§

unsafe fn load32_unchecked(&self, offset: usize) -> u32

Loads a u32 from this MMIO region at the given offset. Read more
Source§

unsafe fn load64_unchecked(&self, offset: usize) -> u64

Loads a u64 from this MMIO region at the given offset. Read more
Source§

unsafe fn store8_unchecked(&self, offset: usize, v: u8)

Stores a u8 to this MMIO region at the given offset. Read more
Source§

unsafe fn store16_unchecked(&self, offset: usize, v: u16)

Stores a u16 to this MMIO region at the given offset. Read more
Source§

unsafe fn store32_unchecked(&self, offset: usize, v: u32)

Stores a u32 to this MMIO region at the given offset. Read more
Source§

unsafe fn store64_unchecked(&self, offset: usize, v: u64)

Stores a u64 to this MMIO region at the given offset. Read more
Source§

fn write_barrier(&self)

Issues a memory write barrier. It is guaranteed that all stores preceding this barrier will appear to have happened before all stores following this barrier.
Source§

fn read_barrier(&self)

Issues a memory read barrier. It is guaranteed that all loads preceding this barrier will appear to have happened before all loads following this barrier. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the MMIO region has a length of 0.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.