pub struct FileAttribute(/* private fields */);
Expand description
File attributes.
Implementations§
source§impl FileAttribute
impl FileAttribute
sourcepub const READ_ONLY: FileAttribute = _
pub const READ_ONLY: FileAttribute = _
The file cannot be opened for modification.
sourcepub const HIDDEN: FileAttribute = _
pub const HIDDEN: FileAttribute = _
The file is hidden from normal directory views.
sourcepub const SYSTEM: FileAttribute = _
pub const SYSTEM: FileAttribute = _
The file belongs to the system and must not be physically moved.
sourcepub const DIRECTORY: FileAttribute = _
pub const DIRECTORY: FileAttribute = _
The file is a directory.
sourcepub const ARCHIVE: FileAttribute = _
pub const ARCHIVE: FileAttribute = _
The file is marked for archival by backup software.
sourcepub const VALID_ATTR: FileAttribute = _
pub const VALID_ATTR: FileAttribute = _
Mask combining all the valid attributes.
source§impl FileAttribute
impl FileAttribute
sourcepub const fn empty() -> FileAttribute
pub const fn empty() -> FileAttribute
Get a flags value with all bits unset.
sourcepub const fn all() -> FileAttribute
pub const fn all() -> FileAttribute
Get a flags value with all known bits set.
sourcepub const fn bits(&self) -> u64
pub const fn bits(&self) -> u64
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
sourcepub const fn from_bits(bits: u64) -> Option<FileAttribute>
pub const fn from_bits(bits: u64) -> Option<FileAttribute>
Convert from a bits value.
This method will return None
if any unknown bits are set.
sourcepub const fn from_bits_truncate(bits: u64) -> FileAttribute
pub const fn from_bits_truncate(bits: u64) -> FileAttribute
Convert from a bits value, unsetting any unknown bits.
sourcepub const fn from_bits_retain(bits: u64) -> FileAttribute
pub const fn from_bits_retain(bits: u64) -> FileAttribute
Convert from a bits value exactly.
sourcepub fn from_name(name: &str) -> Option<FileAttribute>
pub fn from_name(name: &str) -> Option<FileAttribute>
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: FileAttribute) -> bool
pub const fn intersects(&self, other: FileAttribute) -> bool
Whether any set bits in a source flags value are also set in a target flags value.
sourcepub const fn contains(&self, other: FileAttribute) -> bool
pub const fn contains(&self, other: FileAttribute) -> bool
Whether all set bits in a source flags value are also set in a target flags value.
sourcepub fn insert(&mut self, other: FileAttribute)
pub fn insert(&mut self, other: FileAttribute)
The bitwise or (|
) of the bits in two flags values.
sourcepub fn remove(&mut self, other: FileAttribute)
pub fn remove(&mut self, other: FileAttribute)
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: FileAttribute)
pub fn toggle(&mut self, other: FileAttribute)
The bitwise exclusive-or (^
) of the bits in two flags values.
sourcepub fn set(&mut self, other: FileAttribute, value: bool)
pub fn set(&mut self, other: FileAttribute, value: bool)
Call insert
when value
is true
or remove
when value
is false
.
sourcepub const fn intersection(self, other: FileAttribute) -> FileAttribute
pub const fn intersection(self, other: FileAttribute) -> FileAttribute
The bitwise and (&
) of the bits in two flags values.
sourcepub const fn union(self, other: FileAttribute) -> FileAttribute
pub const fn union(self, other: FileAttribute) -> FileAttribute
The bitwise or (|
) of the bits in two flags values.
sourcepub const fn difference(self, other: FileAttribute) -> FileAttribute
pub const fn difference(self, other: FileAttribute) -> FileAttribute
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: FileAttribute) -> FileAttribute
pub const fn symmetric_difference(self, other: FileAttribute) -> FileAttribute
The bitwise exclusive-or (^
) of the bits in two flags values.
sourcepub const fn complement(self) -> FileAttribute
pub const fn complement(self) -> FileAttribute
The bitwise negation (!
) of the bits in a flags value, truncating the result.
source§impl FileAttribute
impl FileAttribute
sourcepub const fn iter(&self) -> Iter<FileAttribute>
pub const fn iter(&self) -> Iter<FileAttribute>
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<FileAttribute>
pub const fn iter_names(&self) -> IterNames<FileAttribute>
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.
Trait Implementations§
source§impl Binary for FileAttribute
impl Binary for FileAttribute
source§impl BitAnd for FileAttribute
impl BitAnd for FileAttribute
source§fn bitand(self, other: FileAttribute) -> FileAttribute
fn bitand(self, other: FileAttribute) -> FileAttribute
The bitwise and (&
) of the bits in two flags values.
§type Output = FileAttribute
type Output = FileAttribute
&
operator.source§impl BitAndAssign for FileAttribute
impl BitAndAssign for FileAttribute
source§fn bitand_assign(&mut self, other: FileAttribute)
fn bitand_assign(&mut self, other: FileAttribute)
The bitwise and (&
) of the bits in two flags values.
source§impl BitOr for FileAttribute
impl BitOr for FileAttribute
source§fn bitor(self, other: FileAttribute) -> FileAttribute
fn bitor(self, other: FileAttribute) -> FileAttribute
The bitwise or (|
) of the bits in two flags values.
§type Output = FileAttribute
type Output = FileAttribute
|
operator.source§impl BitOrAssign for FileAttribute
impl BitOrAssign for FileAttribute
source§fn bitor_assign(&mut self, other: FileAttribute)
fn bitor_assign(&mut self, other: FileAttribute)
The bitwise or (|
) of the bits in two flags values.
source§impl BitXor for FileAttribute
impl BitXor for FileAttribute
source§fn bitxor(self, other: FileAttribute) -> FileAttribute
fn bitxor(self, other: FileAttribute) -> FileAttribute
The bitwise exclusive-or (^
) of the bits in two flags values.
§type Output = FileAttribute
type Output = FileAttribute
^
operator.source§impl BitXorAssign for FileAttribute
impl BitXorAssign for FileAttribute
source§fn bitxor_assign(&mut self, other: FileAttribute)
fn bitxor_assign(&mut self, other: FileAttribute)
The bitwise exclusive-or (^
) of the bits in two flags values.
source§impl Clone for FileAttribute
impl Clone for FileAttribute
source§fn clone(&self) -> FileAttribute
fn clone(&self) -> FileAttribute
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FileAttribute
impl Debug for FileAttribute
source§impl Default for FileAttribute
impl Default for FileAttribute
source§fn default() -> FileAttribute
fn default() -> FileAttribute
source§impl Extend<FileAttribute> for FileAttribute
impl Extend<FileAttribute> for FileAttribute
source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = FileAttribute>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = FileAttribute>,
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 FileAttribute
impl Flags for FileAttribute
source§const FLAGS: &'static [Flag<FileAttribute>] = _
const FLAGS: &'static [Flag<FileAttribute>] = _
source§fn from_bits_retain(bits: u64) -> FileAttribute
fn from_bits_retain(bits: u64) -> FileAttribute
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<FileAttribute> for FileAttribute
impl FromIterator<FileAttribute> for FileAttribute
source§fn from_iter<T>(iterator: T) -> FileAttributewhere
T: IntoIterator<Item = FileAttribute>,
fn from_iter<T>(iterator: T) -> FileAttributewhere
T: IntoIterator<Item = FileAttribute>,
The bitwise or (|
) of the bits in each flags value.
source§impl IntoIterator for FileAttribute
impl IntoIterator for FileAttribute
§type Item = FileAttribute
type Item = FileAttribute
§type IntoIter = Iter<FileAttribute>
type IntoIter = Iter<FileAttribute>
source§fn into_iter(self) -> <FileAttribute as IntoIterator>::IntoIter
fn into_iter(self) -> <FileAttribute as IntoIterator>::IntoIter
source§impl LowerHex for FileAttribute
impl LowerHex for FileAttribute
source§impl Not for FileAttribute
impl Not for FileAttribute
source§fn not(self) -> FileAttribute
fn not(self) -> FileAttribute
The bitwise negation (!
) of the bits in a flags value, truncating the result.
§type Output = FileAttribute
type Output = FileAttribute
!
operator.source§impl Octal for FileAttribute
impl Octal for FileAttribute
source§impl Ord for FileAttribute
impl Ord for FileAttribute
source§fn cmp(&self, other: &FileAttribute) -> Ordering
fn cmp(&self, other: &FileAttribute) -> 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 FileAttribute
impl PartialEq for FileAttribute
source§fn eq(&self, other: &FileAttribute) -> bool
fn eq(&self, other: &FileAttribute) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for FileAttribute
impl PartialOrd for FileAttribute
source§fn partial_cmp(&self, other: &FileAttribute) -> Option<Ordering>
fn partial_cmp(&self, other: &FileAttribute) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Sub for FileAttribute
impl Sub for FileAttribute
source§fn sub(self, other: FileAttribute) -> FileAttribute
fn sub(self, other: FileAttribute) -> FileAttribute
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.
§type Output = FileAttribute
type Output = FileAttribute
-
operator.source§impl SubAssign for FileAttribute
impl SubAssign for FileAttribute
source§fn sub_assign(&mut self, other: FileAttribute)
fn sub_assign(&mut self, other: FileAttribute)
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.