pub struct OwnedWritableCapability<T> { /* private fields */ }Expand description
RAII wrapper around a WritableCapability<T> that owns the
underlying Box<T> allocation and reclaims it on Drop.
Implementations§
Source§impl<T> OwnedWritableCapability<T>
impl<T> OwnedWritableCapability<T>
pub fn cap(&self) -> &WritableCapability<T>
pub fn cap_mut(&mut self) -> &mut WritableCapability<T>
Methods from Deref<Target = WritableCapability<T>>§
pub const SIGNATURE: AxisMask
pub fn has_permission(&self, p: CapabilityPermission) -> bool
pub fn is_sealed(&self) -> bool
Sourcepub fn read(&self) -> Result<T, CapabilityError>where
T: Copy,
pub fn read(&self) -> Result<T, CapabilityError>where
T: Copy,
Read through the capability.
Sourcepub fn write(&mut self, value: T) -> Result<(), CapabilityError>
pub fn write(&mut self, value: T) -> Result<(), CapabilityError>
Write through the capability. The &mut self receiver + the
constructor’s &mut [T] / Box-consuming nature provide the
unique-writer guarantee.
Sourcepub fn narrow(
&self,
sub_base: usize,
sub_length: u32,
sub_perms: u32,
) -> Result<Self, CapabilityError>
pub fn narrow( &self, sub_base: usize, sub_length: u32, sub_perms: u32, ) -> Result<Self, CapabilityError>
Narrow to a sub-range, returning a new WritableCapability.
To narrow to a read-only view, use narrow_readable.
Sourcepub fn narrow_readable(
&self,
sub_base: usize,
sub_length: u32,
sub_perms: u32,
) -> Result<ReadableCapability<T>, CapabilityError>
pub fn narrow_readable( &self, sub_base: usize, sub_length: u32, sub_perms: u32, ) -> Result<ReadableCapability<T>, CapabilityError>
Narrow to a read-only view. Returned ReadableCapability does
NOT have Write perm regardless of what sub_perms contains.
Sourcepub fn as_readable(&self) -> ReadableCapability<T>
pub fn as_readable(&self) -> ReadableCapability<T>
Borrow this WritableCapability as a ReadableCapability view (no Write perm, no transfer of ownership). The borrow checker prevents the writable cap from being used while the readable view is alive.
Trait Implementations§
Source§impl<T> Deref for OwnedWritableCapability<T>
impl<T> Deref for OwnedWritableCapability<T>
Source§impl<T> DerefMut for OwnedWritableCapability<T>
impl<T> DerefMut for OwnedWritableCapability<T>
Source§impl<T> Drop for OwnedWritableCapability<T>
impl<T> Drop for OwnedWritableCapability<T>
Auto Trait Implementations§
impl<T> !Send for OwnedWritableCapability<T>
impl<T> !Sync for OwnedWritableCapability<T>
impl<T> Freeze for OwnedWritableCapability<T>
impl<T> RefUnwindSafe for OwnedWritableCapability<T>where
T: RefUnwindSafe,
impl<T> Unpin for OwnedWritableCapability<T>
impl<T> UnsafeUnpin for OwnedWritableCapability<T>
impl<T> UnwindSafe for OwnedWritableCapability<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more