pub struct CapabilitySet { /* private fields */ }Expand description
A set of capabilities granted to a piece of code
Implementations§
Source§impl CapabilitySet
impl CapabilitySet
Sourcepub fn from_capabilities<I>(caps: I) -> Selfwhere
I: IntoIterator<Item = Capability>,
pub fn from_capabilities<I>(caps: I) -> Selfwhere
I: IntoIterator<Item = Capability>,
Create a capability set with the given capabilities
Sourcepub fn grant(&mut self, cap: Capability)
pub fn grant(&mut self, cap: Capability)
Add a capability to the set
Sourcepub fn revoke(&mut self, cap: &Capability) -> bool
pub fn revoke(&mut self, cap: &Capability) -> bool
Remove a capability from the set
Sourcepub fn has(&self, cap: &Capability) -> bool
pub fn has(&self, cap: &Capability) -> bool
Check if a capability is granted
Sourcepub fn has_by_name(&self, name: &str) -> bool
pub fn has_by_name(&self, name: &str) -> bool
Check if a capability is granted by name
Sourcepub fn has_matching(&self, requested: &Capability) -> bool
pub fn has_matching(&self, requested: &Capability) -> bool
Check if a capability is granted, with pattern matching for parameterized capabilities
Sourcepub fn intersection(&self, other: &CapabilitySet) -> CapabilitySet
pub fn intersection(&self, other: &CapabilitySet) -> CapabilitySet
Create an intersection of two capability sets
Sourcepub fn union(&self, other: &CapabilitySet) -> CapabilitySet
pub fn union(&self, other: &CapabilitySet) -> CapabilitySet
Create a union of two capability sets
Sourcepub fn is_subset(&self, other: &CapabilitySet) -> bool
pub fn is_subset(&self, other: &CapabilitySet) -> bool
Check if this set is a subset of another
Sourcepub fn iter(&self) -> impl Iterator<Item = &Capability>
pub fn iter(&self) -> impl Iterator<Item = &Capability>
Get an iterator over the capabilities
Trait Implementations§
Source§impl Clone for CapabilitySet
impl Clone for CapabilitySet
Source§fn clone(&self) -> CapabilitySet
fn clone(&self) -> CapabilitySet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CapabilitySet
impl Debug for CapabilitySet
Source§impl Default for CapabilitySet
impl Default for CapabilitySet
Source§fn default() -> CapabilitySet
fn default() -> CapabilitySet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CapabilitySet
impl RefUnwindSafe for CapabilitySet
impl Send for CapabilitySet
impl Sync for CapabilitySet
impl Unpin for CapabilitySet
impl UnwindSafe for CapabilitySet
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