pub struct Permission(/* private fields */);Expand description
Defines the permission of a file or directory in a POSIX system.
Implementations§
source§impl Permission
impl Permission
pub const OWNER_READ: Permission = _
pub const OWNER_WRITE: Permission = _
pub const OWNER_EXEC: Permission = _
pub const OWNER_ALL: Permission = _
pub const GROUP_READ: Permission = _
pub const GROUP_WRITE: Permission = _
pub const GROUP_EXEC: Permission = _
pub const GROUP_ALL: Permission = _
pub const OTHERS_READ: Permission = _
pub const OTHERS_WRITE: Permission = _
pub const OTHERS_EXEC: Permission = _
pub const OTHERS_ALL: Permission = _
pub const ALL: Permission = _
pub const SET_UID: Permission = _
pub const SET_GID: Permission = _
pub const STICKY_BIT: Permission = _
pub const MASK: Permission = _
pub const UNKNOWN: Permission = _
source§impl Permission
impl Permission
sourcepub const fn empty() -> Permission
pub const fn empty() -> Permission
Get a flags value with all bits unset.
sourcepub const fn all() -> Permission
pub const fn all() -> Permission
Get a flags value with all known bits set.
sourcepub const fn bits(&self) -> u32
pub const fn bits(&self) -> u32
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
sourcepub const fn from_bits(bits: u32) -> Option<Permission>
pub const fn from_bits(bits: u32) -> Option<Permission>
Convert from a bits value.
This method will return None if any unknown bits are set.
sourcepub const fn from_bits_truncate(bits: u32) -> Permission
pub const fn from_bits_truncate(bits: u32) -> Permission
Convert from a bits value, unsetting any unknown bits.
sourcepub const fn from_bits_retain(bits: u32) -> Permission
pub const fn from_bits_retain(bits: u32) -> Permission
Convert from a bits value exactly.
sourcepub fn from_name(name: &str) -> Option<Permission>
pub fn from_name(name: &str) -> Option<Permission>
Get a flags value with the bits of a flag with the given name set.
This method will return None if name is empty or doesn’t
correspond to any named flag.
sourcepub const fn intersects(&self, other: Permission) -> bool
pub const fn intersects(&self, other: Permission) -> bool
Whether any set bits in a source flags value are also set in a target flags value.
sourcepub const fn contains(&self, other: Permission) -> bool
pub const fn contains(&self, other: Permission) -> bool
Whether all set bits in a source flags value are also set in a target flags value.
sourcepub fn insert(&mut self, other: Permission)
pub fn insert(&mut self, other: Permission)
The bitwise or (|) of the bits in two flags values.
sourcepub fn remove(&mut self, other: Permission)
pub fn remove(&mut self, other: Permission)
The intersection of a source flags value with the complement of a target flags value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
remove won’t truncate other, but the ! operator will.
sourcepub fn toggle(&mut self, other: Permission)
pub fn toggle(&mut self, other: Permission)
The bitwise exclusive-or (^) of the bits in two flags values.
sourcepub fn set(&mut self, other: Permission, value: bool)
pub fn set(&mut self, other: Permission, value: bool)
Call insert when value is true or remove when value is false.
sourcepub const fn intersection(self, other: Permission) -> Permission
pub const fn intersection(self, other: Permission) -> Permission
The bitwise and (&) of the bits in two flags values.
sourcepub const fn union(self, other: Permission) -> Permission
pub const fn union(self, other: Permission) -> Permission
The bitwise or (|) of the bits in two flags values.
sourcepub const fn difference(self, other: Permission) -> Permission
pub const fn difference(self, other: Permission) -> Permission
The intersection of a source flags value with the complement of a target flags value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
sourcepub const fn symmetric_difference(self, other: Permission) -> Permission
pub const fn symmetric_difference(self, other: Permission) -> Permission
The bitwise exclusive-or (^) of the bits in two flags values.
sourcepub const fn complement(self) -> Permission
pub const fn complement(self) -> Permission
The bitwise negation (!) of the bits in a flags value, truncating the result.
source§impl Permission
impl Permission
sourcepub const fn iter(&self) -> Iter<Permission>
pub const fn iter(&self) -> Iter<Permission>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
sourcepub const fn iter_names(&self) -> IterNames<Permission>
pub const fn iter_names(&self) -> IterNames<Permission>
Yield a set of contained named flags values.
This method is like iter, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
source§impl Permission
impl Permission
pub fn none() -> Permission
source§impl Permission
impl Permission
Trait Implementations§
source§impl Binary for Permission
impl Binary for Permission
source§impl BitAnd for Permission
impl BitAnd for Permission
source§fn bitand(self, other: Permission) -> Permission
fn bitand(self, other: Permission) -> Permission
The bitwise and (&) of the bits in two flags values.
source§type Output = Permission
type Output = Permission
& operator.source§impl BitAndAssign for Permission
impl BitAndAssign for Permission
source§fn bitand_assign(&mut self, other: Permission)
fn bitand_assign(&mut self, other: Permission)
The bitwise and (&) of the bits in two flags values.
source§impl BitOr for Permission
impl BitOr for Permission
source§fn bitor(self, other: Permission) -> Permission
fn bitor(self, other: Permission) -> Permission
The bitwise or (|) of the bits in two flags values.
source§type Output = Permission
type Output = Permission
| operator.source§impl BitOrAssign for Permission
impl BitOrAssign for Permission
source§fn bitor_assign(&mut self, other: Permission)
fn bitor_assign(&mut self, other: Permission)
The bitwise or (|) of the bits in two flags values.
source§impl BitXor for Permission
impl BitXor for Permission
source§fn bitxor(self, other: Permission) -> Permission
fn bitxor(self, other: Permission) -> Permission
The bitwise exclusive-or (^) of the bits in two flags values.
source§type Output = Permission
type Output = Permission
^ operator.source§impl BitXorAssign for Permission
impl BitXorAssign for Permission
source§fn bitxor_assign(&mut self, other: Permission)
fn bitxor_assign(&mut self, other: Permission)
The bitwise exclusive-or (^) of the bits in two flags values.
source§impl Clone for Permission
impl Clone for Permission
source§fn clone(&self) -> Permission
fn clone(&self) -> Permission
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for Permission
impl Debug for Permission
source§impl Default for Permission
impl Default for Permission
source§fn default() -> Permission
fn default() -> Permission
source§impl Display for Permission
impl Display for Permission
source§impl Extend<Permission> for Permission
impl Extend<Permission> for Permission
source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Permission>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Permission>,
The bitwise or (|) of the bits in each flags value.
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)source§impl Flags for Permission
impl Flags for Permission
source§const FLAGS: &'static [Flag<Permission>] = _
const FLAGS: &'static [Flag<Permission>] = _
source§fn from_bits_retain(bits: u32) -> Permission
fn from_bits_retain(bits: u32) -> Permission
source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
source§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in two flags values.source§fn remove(&mut self, other: Self)where
Self: Sized,
fn remove(&mut self, other: Self)where
Self: Sized,
&!). Read moresource§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in two flags values.source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in two flags values.source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
&!). Read moresource§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in two flags values.source§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in a flags value, truncating the result.source§impl FromIterator<Permission> for Permission
impl FromIterator<Permission> for Permission
source§fn from_iter<T>(iterator: T) -> Permissionwhere
T: IntoIterator<Item = Permission>,
fn from_iter<T>(iterator: T) -> Permissionwhere
T: IntoIterator<Item = Permission>,
The bitwise or (|) of the bits in each flags value.
source§impl IntoIterator for Permission
impl IntoIterator for Permission
source§type Item = Permission
type Item = Permission
source§type IntoIter = Iter<Permission>
type IntoIter = Iter<Permission>
source§fn into_iter(self) -> <Permission as IntoIterator>::IntoIter
fn into_iter(self) -> <Permission as IntoIterator>::IntoIter
source§impl LowerHex for Permission
impl LowerHex for Permission
source§impl Not for Permission
impl Not for Permission
source§fn not(self) -> Permission
fn not(self) -> Permission
The bitwise negation (!) of the bits in a flags value, truncating the result.
source§type Output = Permission
type Output = Permission
! operator.source§impl Octal for Permission
impl Octal for Permission
source§impl PartialEq for Permission
impl PartialEq for Permission
source§impl Sub for Permission
impl Sub for Permission
source§fn sub(self, other: Permission) -> Permission
fn sub(self, other: Permission) -> Permission
The intersection of a source flags value with the complement of a target flags value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
source§type Output = Permission
type Output = Permission
- operator.source§impl SubAssign for Permission
impl SubAssign for Permission
source§fn sub_assign(&mut self, other: Permission)
fn sub_assign(&mut self, other: Permission)
The intersection of a source flags value with the complement of a target flags value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
source§impl UpperHex for Permission
impl UpperHex for Permission
impl Copy for Permission
impl Eq for Permission
impl StructuralPartialEq for Permission
Auto Trait Implementations§
impl Freeze for Permission
impl RefUnwindSafe for Permission
impl Send for Permission
impl Sync for Permission
impl Unpin for Permission
impl UnwindSafe for Permission
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)