[][src]Struct capctl::caps::CapSet

pub struct CapSet { /* fields omitted */ }

Represents a set of capabilities.

Internally, this stores the set of capabilities as a bitmask, which is much more efficient than a HashSet<Cap>.

Implementations

impl CapSet[src]

pub const fn empty() -> Self[src]

Create an empty capability set.

pub fn clear(&mut self)[src]

Clear all capabilities from this set.

After this call, set.is_empty() will return true.

pub fn is_empty(&self) -> bool[src]

Check if this capability set is empty.

pub fn size(&self) -> usize[src]

Returns the number of capabilities in this capability set.

pub fn has(&self, cap: Cap) -> bool[src]

Checks if a given capability is present in this set.

pub fn add(&mut self, cap: Cap)[src]

Adds the given capability to this set.

pub fn drop(&mut self, cap: Cap)[src]

Removes the given capability from this set.

pub fn set_state(&mut self, cap: Cap, val: bool)[src]

If val is true the given capability is added; otherwise it is removed.

pub fn add_all<T: IntoIterator<Item = Cap>>(&mut self, t: T)[src]

Adds all of the capabilities yielded by the given iterator to this set.

pub fn drop_all<T: IntoIterator<Item = Cap>>(&mut self, t: T)[src]

Removes all of the capabilities yielded by the given iterator from this set.

pub fn iter(&self) -> CapSetIterator

Notable traits for CapSetIterator

impl Iterator for CapSetIterator type Item = Cap;
[src]

Returns an iterator over all of the capabilities in this set.

pub const fn union(&self, other: Self) -> Self[src]

Returns the union of this set and another capability set (i.e. all the capabilities that are in either set).

pub const fn intersection(&self, other: Self) -> Self[src]

Returns the intersection of this set and another capability set (i.e. all the capabilities that are in both sets).

Trait Implementations

impl BitAnd<CapSet> for CapSet[src]

type Output = Self

The resulting type after applying the & operator.

impl BitOr<CapSet> for CapSet[src]

type Output = Self

The resulting type after applying the | operator.

impl BitXor<CapSet> for CapSet[src]

type Output = Self

The resulting type after applying the ^ operator.

impl Clone for CapSet[src]

impl Copy for CapSet[src]

impl Debug for CapSet[src]

impl Default for CapSet[src]

impl Eq for CapSet[src]

impl Extend<Cap> for CapSet[src]

impl FromIterator<Cap> for CapSet[src]

impl Hash for CapSet[src]

impl IntoIterator for CapSet[src]

type Item = Cap

The type of the elements being iterated over.

type IntoIter = CapSetIterator

Which kind of iterator are we turning this into?

impl Not for CapSet[src]

type Output = Self

The resulting type after applying the ! operator.

impl PartialEq<CapSet> for CapSet[src]

impl StructuralEq for CapSet[src]

impl StructuralPartialEq for CapSet[src]

impl Sub<CapSet> for CapSet[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for CapSet

impl Send for CapSet

impl Sync for CapSet

impl Unpin for CapSet

impl UnwindSafe for CapSet

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.