Skip to main content

FileAttributes

Struct FileAttributes 

Source
pub struct FileAttributes(/* private fields */);
Expand description

The attributes a file is created with: a set of ARCHIVE, HIDDEN, OFFLINE, READONLY, SYSTEM and TEMPORARY, named as CreateFileW names FILE_ATTRIBUTE_* without their prefix.

use win_durable_ioring::windows_backend::FileAttributes;

let attributes = FileAttributes::HIDDEN | FileAttributes::SYSTEM;

assert!(attributes.contains(FileAttributes::HIDDEN));
assert!(!attributes.contains(FileAttributes::READONLY));
assert!(FileAttributes::NONE.is_empty());

They apply to a file the open creates. The CreateFileW page says that for a file that exists the supplied attributes are generally combined with it or ignored, which is Win32’s and is not refined here; FileOptions::attributes says what was measured. The page also says applications should not change OFFLINE arbitrarily.

The empty set asks for no attribute and is what an open passes when none is given; it is not FILE_ATTRIBUTE_NORMAL, which the page defines as valid only alone.

Implementations§

Source§

impl FileAttributes

Source

pub const ARCHIVE: Self

FILE_ATTRIBUTE_ARCHIVE: the file is marked for backup or removal.

Source

pub const HIDDEN: Self

FILE_ATTRIBUTE_HIDDEN: the file is hidden, and not included in an ordinary directory listing.

Source

pub const OFFLINE: Self

FILE_ATTRIBUTE_OFFLINE: the data is not immediately available, because it has been moved to offline storage. The CreateFileW page says an application should not change it arbitrarily.

Source

pub const READONLY: Self

FILE_ATTRIBUTE_READONLY: the file can be read and not written or deleted.

Source

pub const SYSTEM: Self

FILE_ATTRIBUTE_SYSTEM: the file is part of, or used exclusively by, the operating system.

Source

pub const TEMPORARY: Self

FILE_ATTRIBUTE_TEMPORARY: the file is for temporary storage. The page says it lets a file system keep the data in the cache and avoid writing it back while memory allows.

Source§

impl FileAttributes

Source

pub const NONE: Self

No attribute: what an open asks for unless it is told otherwise.

Source

pub const fn union(self, other: Self) -> Self

The union of two sets.

Source

pub const fn contains(self, other: Self) -> bool

Whether every member of other is in this set.

Source

pub const fn is_empty(self) -> bool

Whether the set has no member.

Trait Implementations§

Source§

impl BitOr for FileAttributes

Source§

type Output = FileAttributes

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Self) -> Self

Performs the | operation. Read more
Source§

impl BitOrAssign for FileAttributes

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl Clone for FileAttributes

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FileAttributes

Source§

impl Debug for FileAttributes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FileAttributes

Source§

impl Hash for FileAttributes

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FileAttributes

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileAttributes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.