Skip to main content

MemoryMappedArcVmo

Struct MemoryMappedArcVmo 

Source
pub struct MemoryMappedArcVmo<const WRITABLE: bool, M: Send + Sync = ()> { /* private fields */ }
Expand description

Reference-counted MemoryMappedVmo backed by an auxiliary control VMO to store the reference count and, optionally, extra shared metadata.

Implementations§

Source§

impl<const WRITABLE: bool, M: Send + Sync> MemoryMappedArcVmo<WRITABLE, M>

Source

pub unsafe fn wrap( storage: MemoryMappedVmo<WRITABLE>, metadata: M, ) -> Result<Self, Status>

Wraps a MemoryMappedVmo into a MemoryMappedArcVmo with the given extra metadata.

§Safety

The caller must either guarantee that the VMO is not modified by others while the returned instance is alive or that accesses are synchronized in application-specific ways.

Source

pub unsafe fn wrap_with_name( storage: MemoryMappedVmo<WRITABLE>, metadata: M, control_vmo_name: &Name, ) -> Result<Self, Status>

Like wrap, but also sets the control VMO name.

§Safety

The caller must either guarantee that the VMO is not modified by others while the returned instance is alive or that accesses are synchronized in application-specific ways.

Source

pub fn metadata(&self) -> &M

Returns a shared reference to the metadata stored in the control block.

Source§

impl<M: Send + Sync> MemoryMappedArcVmo<true, M>

Source

pub fn into_readonly(self) -> MemoryMappedArcVmo<false, M>

Downgrades a read-write mapping handle into a read-only mapping handle without unmapping.

Methods from Deref<Target = MemoryMappedVmo<WRITABLE>>§

Source

pub fn vmo_size(&self) -> usize

Returns the number of usable bytes in the VMO (i.e. its ZX_PROP_VMO_CONTENT_SIZE property, which is not rounded to the page size).

Source

pub fn get_slice<'a, T: FromBytes>( &'a self, byte_offset: usize, num_elements: usize, ) -> Result<&'a [T], Error>

Returns a reference to a slice of elements in the VMO.

This method validates the alignment and the bounds against the VMO size.

Source

pub fn get_object<'a, T: FromBytes>( &'a self, byte_offset: usize, ) -> Result<&'a T, Error>

Returns a reference to an element in the VMO.

This method validates the alignment and the bounds against the VMO size.

Source

pub fn get_slice_mut<'a, T: FromBytes>( &'a mut self, byte_offset: usize, num_elements: usize, ) -> Result<&'a mut [T], Error>

Returns a mutable reference to a slice of elements in the VMO.

This method validates the alignment and the bounds against the VMO size.

Source

pub fn get_object_mut<'a, T: FromBytes>( &'a mut self, byte_offset: usize, ) -> Result<&'a mut T, Error>

Returns a mutable reference to an element in the VMO.

This method validates the alignment and the bounds against the VMO size.

Trait Implementations§

Source§

impl<const WRITABLE: bool, M: Send + Sync> Clone for MemoryMappedArcVmo<WRITABLE, M>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const WRITABLE: bool, M: Send + Sync> Deref for MemoryMappedArcVmo<WRITABLE, M>

Source§

type Target = MemoryMappedVmo<WRITABLE>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<M: Send + Sync> DerefMut for MemoryMappedArcVmo<true, M>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<const WRITABLE: bool, M: Send + Sync> Drop for MemoryMappedArcVmo<WRITABLE, M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<const WRITABLE: bool, M> Freeze for MemoryMappedArcVmo<WRITABLE, M>

§

impl<const WRITABLE: bool, M> RefUnwindSafe for MemoryMappedArcVmo<WRITABLE, M>

§

impl<const WRITABLE: bool, M> Send for MemoryMappedArcVmo<WRITABLE, M>

§

impl<const WRITABLE: bool, M> Sync for MemoryMappedArcVmo<WRITABLE, M>

§

impl<const WRITABLE: bool, M> Unpin for MemoryMappedArcVmo<WRITABLE, M>

§

impl<const WRITABLE: bool, M> UnsafeUnpin for MemoryMappedArcVmo<WRITABLE, M>

§

impl<const WRITABLE: bool, M> UnwindSafe for MemoryMappedArcVmo<WRITABLE, M>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.