#[repr(transparent)]pub struct PermissionFlags {
bits: u16,
}
Expand description
Fields§
§bits: u16
Implementations§
Source§impl PermissionFlags
impl PermissionFlags
Sourcepub const CANNOT_BE_RESIGNED: Self
pub const CANNOT_BE_RESIGNED: Self
Bit 0: Cannot be resigned
Source§impl PermissionFlags
impl PermissionFlags
Sourcepub const fn from_bits(bits: u16) -> Option<Self>
pub const fn from_bits(bits: u16) -> Option<Self>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
Sourcepub const fn from_bits_truncate(bits: u16) -> Self
pub const fn from_bits_truncate(bits: u16) -> Self
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
Sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Returns true
if there are flags common to both self
and other
.
Sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Returns true
if all of the flags in other
are contained within self
.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both.
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
Trait Implementations§
Source§impl Binary for PermissionFlags
impl Binary for PermissionFlags
Source§impl BitAnd for PermissionFlags
impl BitAnd for PermissionFlags
Source§impl BitAndAssign for PermissionFlags
impl BitAndAssign for PermissionFlags
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Disables all flags disabled in the set.
Source§impl BitOr for PermissionFlags
impl BitOr for PermissionFlags
Source§fn bitor(self, other: PermissionFlags) -> Self
fn bitor(self, other: PermissionFlags) -> Self
Returns the union of the two sets of flags.
Source§type Output = PermissionFlags
type Output = PermissionFlags
|
operator.Source§impl BitOrAssign for PermissionFlags
impl BitOrAssign for PermissionFlags
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Adds the set of flags.
Source§impl BitXor for PermissionFlags
impl BitXor for PermissionFlags
Source§impl BitXorAssign for PermissionFlags
impl BitXorAssign for PermissionFlags
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Toggles the set of flags.
Source§impl Clone for PermissionFlags
impl Clone for PermissionFlags
Source§fn clone(&self) -> PermissionFlags
fn clone(&self) -> PermissionFlags
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PermissionFlags
impl Debug for PermissionFlags
Source§impl Default for PermissionFlags
impl Default for PermissionFlags
Source§fn default() -> PermissionFlags
fn default() -> PermissionFlags
Source§impl<'a> From<PermissionFlags> for FieldType<'a>
impl<'a> From<PermissionFlags> for FieldType<'a>
Source§fn from(src: PermissionFlags) -> FieldType<'a>
fn from(src: PermissionFlags) -> FieldType<'a>
Source§impl Hash for PermissionFlags
impl Hash for PermissionFlags
Source§impl LowerHex for PermissionFlags
impl LowerHex for PermissionFlags
Source§impl Not for PermissionFlags
impl Not for PermissionFlags
Source§impl Octal for PermissionFlags
impl Octal for PermissionFlags
Source§impl Ord for PermissionFlags
impl Ord for PermissionFlags
Source§fn cmp(&self, other: &PermissionFlags) -> Ordering
fn cmp(&self, other: &PermissionFlags) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PermissionFlags
impl PartialEq for PermissionFlags
Source§impl PartialOrd for PermissionFlags
impl PartialOrd for PermissionFlags
Source§impl Scalar for PermissionFlags
impl Scalar for PermissionFlags
Source§impl Sub for PermissionFlags
impl Sub for PermissionFlags
Source§impl SubAssign for PermissionFlags
impl SubAssign for PermissionFlags
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Disables all flags enabled in the set.
Source§impl UpperHex for PermissionFlags
impl UpperHex for PermissionFlags
impl AnyBitPattern for PermissionFlags
impl Copy for PermissionFlags
impl Eq for PermissionFlags
impl StructuralPartialEq for PermissionFlags
Auto Trait Implementations§
impl Freeze for PermissionFlags
impl RefUnwindSafe for PermissionFlags
impl Send for PermissionFlags
impl Sync for PermissionFlags
impl Unpin for PermissionFlags
impl UnwindSafe for PermissionFlags
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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.