pub struct Rights { /* private fields */ }Expand description
Set of rights backed by a u16 bitset.
Each of the 10 rights maps to one bit (bit 0 = Read, …, bit 9 = Declassify). All set operations are O(1) bitwise ops.
Implementations§
Source§impl Rights
impl Rights
Sourcepub fn from_slice(rights: &[Right]) -> Rights
pub fn from_slice(rights: &[Right]) -> Rights
Create from a slice of rights.
Sourcepub fn read_write() -> Rights
pub fn read_write() -> Rights
Read-write access rights.
Sourcepub fn read_write_execute() -> Rights
pub fn read_write_execute() -> Rights
Read-write-execute access rights.
Sourcepub fn insert(&mut self, right: Right) -> bool
pub fn insert(&mut self, right: Right) -> bool
Insert a right into the set. Returns true if the right was not already present.
Sourcepub fn remove(&mut self, right: Right) -> bool
pub fn remove(&mut self, right: Right) -> bool
Remove a right from the set. Returns true if the right was present.
Sourcepub const fn is_subset_of(&self, other: &Rights) -> bool
pub const fn is_subset_of(&self, other: &Rights) -> bool
Subset check: r1 <= r2 iff r1 is subset of r2.
Sourcepub const fn is_superset_of(&self, other: &Rights) -> bool
pub const fn is_superset_of(&self, other: &Rights) -> bool
Superset check.
Sourcepub const fn combine(&self, other: &Rights) -> Rights
pub const fn combine(&self, other: &Rights) -> Rights
Combine rights via intersection (for delegation – confinement property).
Sourcepub const fn intersection(&self, other: &Rights) -> Rights
pub const fn intersection(&self, other: &Rights) -> Rights
Alias for combine – intersection of two rights sets.
Sourcepub const fn difference(&self, other: &Rights) -> Rights
pub const fn difference(&self, other: &Rights) -> Rights
Difference of two rights sets (self - other).
Sourcepub const fn symmetric_difference(&self, other: &Rights) -> Rights
pub const fn symmetric_difference(&self, other: &Rights) -> Rights
Symmetric difference of two rights sets.
Sourcepub const fn complement(&self) -> Rights
pub const fn complement(&self) -> Rights
Complement (all rights NOT in this set).
Sourcepub const fn contains_all(&self, other: &Rights) -> bool
pub const fn contains_all(&self, other: &Rights) -> bool
Check if this set contains all rights from another set.
Sourcepub const fn contains_any(&self, other: &Rights) -> bool
pub const fn contains_any(&self, other: &Rights) -> bool
Check if this set contains any right from another set.
Sourcepub const fn without(&self, right: Right) -> Rights
pub const fn without(&self, right: Right) -> Rights
Return a new set with the given right removed.
Sourcepub const fn iter(&self) -> RightsIter ⓘ
pub const fn iter(&self) -> RightsIter ⓘ
Iterate over the rights in the set (sorted by discriminant order).
Trait Implementations§
Source§impl BitAndAssign for Rights
impl BitAndAssign for Rights
Source§fn bitand_assign(&mut self, rhs: Rights)
fn bitand_assign(&mut self, rhs: Rights)
&= operation. Read moreSource§impl BitOrAssign for Rights
impl BitOrAssign for Rights
Source§fn bitor_assign(&mut self, rhs: Rights)
fn bitor_assign(&mut self, rhs: Rights)
|= operation. Read more