pub struct CapabilityTable { /* private fields */ }Expand description
Table of capabilities for a process
Implementations§
Source§impl CapabilityTable
impl CapabilityTable
Sourcepub fn insert(&mut self, cap: Capability) -> CapId
pub fn insert(&mut self, cap: Capability) -> CapId
Insert a capability into the table
Sourcepub fn remove(&mut self, id: CapId) -> Option<Capability>
pub fn remove(&mut self, id: CapId) -> Option<Capability>
Remove a capability from the table
Sourcepub fn get(&self, id: CapId) -> Option<&Capability>
pub fn get(&self, id: CapId) -> Option<&Capability>
Get a reference to a capability (no permission check).
Sourcepub fn revoke_all(&mut self)
pub fn revoke_all(&mut self)
Revoke all capabilities in this table and clear it. Does not allocate memory.
Sourcepub fn has_resource_type_with_permissions(
&self,
resource_type: ResourceType,
required: CapPermissions,
) -> bool
pub fn has_resource_type_with_permissions( &self, resource_type: ResourceType, required: CapPermissions, ) -> bool
Check whether any capability of the given resource type has required permissions.
Sourcepub fn has_resource_with_permissions(
&self,
resource_type: ResourceType,
resource: usize,
required: CapPermissions,
) -> bool
pub fn has_resource_with_permissions( &self, resource_type: ResourceType, resource: usize, required: CapPermissions, ) -> bool
Check whether a specific resource has required permissions.
Sourcepub fn get_with_permissions(
&self,
id: CapId,
required: CapPermissions,
) -> Option<&Capability>
pub fn get_with_permissions( &self, id: CapId, required: CapPermissions, ) -> Option<&Capability>
Get a reference to a capability if it exists and has the required permissions
Sourcepub fn get_mut_with_permissions(
&mut self,
id: CapId,
required: CapPermissions,
) -> Option<&mut Capability>
pub fn get_mut_with_permissions( &mut self, id: CapId, required: CapPermissions, ) -> Option<&mut Capability>
Get a mutable reference to a capability if it exists and has the required permissions
Sourcepub fn duplicate(&mut self, id: CapId) -> Option<Capability>
pub fn duplicate(&mut self, id: CapId) -> Option<Capability>
Duplicate a capability (grant permission required)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CapabilityTable
impl RefUnwindSafe for CapabilityTable
impl Send for CapabilityTable
impl Sync for CapabilityTable
impl Unpin for CapabilityTable
impl UnsafeUnpin for CapabilityTable
impl UnwindSafe for CapabilityTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more