Skip to main content

FileRights

Struct FileRights 

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

A set of file access rights other than the data rights, which are the DataAccess of the handle.

Each member is one right the documentation lists for a file, named as CreateFileW names it without its prefix: WRITE_ATTRIBUTES is FILE_WRITE_ATTRIBUTES, and the standard rights keep their names. A set is made by joining them with |:

use win_durable_ioring::windows_backend::FileRights;

let rights = FileRights::READ_ATTRIBUTES | FileRights::WRITE_ATTRIBUTES;

assert!(rights.contains(FileRights::WRITE_ATTRIBUTES));
assert!(!rights.contains(FileRights::DELETE));
assert!(FileRights::NONE.is_empty());

There is no generic right and no FILE_ALL_ACCESS. A generic right mixes the data rights, which are a type, with others, and the kernel expands it when it opens, so a set could not say what it holds. Ask for the data access with FileOptions::read and write, and for the rest with the members here.

Append-only access is not offered, by construction: there is no member for FILE_APPEND_DATA, and no data access asks for it. A write through a handle opened for appending only lands at the end of the file whatever offset it names, and the core addresses every write by offset.

The set has no constructor from a raw mask. A right Win32 defines and this table does not list cannot be expressed until the table gains it.

Implementations§

Source§

impl FileRights

Source

pub const READ_ATTRIBUTES: Self

FILE_READ_ATTRIBUTES: read the file’s attributes.

Source

pub const WRITE_ATTRIBUTES: Self

FILE_WRITE_ATTRIBUTES: write the file’s attributes, among them its times.

Source

pub const READ_EA: Self

FILE_READ_EA: read the file’s extended attributes.

Source

pub const WRITE_EA: Self

FILE_WRITE_EA: write the file’s extended attributes.

Source

pub const EXECUTE: Self

FILE_EXECUTE: execute the file, for a native code file.

Source

pub const DELETE: Self

DELETE: delete or rename the file.

Source

pub const READ_CONTROL: Self

READ_CONTROL: read the file’s security descriptor, without its system ACL.

Source

pub const WRITE_DAC: Self

WRITE_DAC: change the file’s discretionary ACL.

Source

pub const WRITE_OWNER: Self

WRITE_OWNER: change the file’s owner.

Source

pub const SYNCHRONIZE: Self

SYNCHRONIZE: wait on the handle.

Source

pub const ACCESS_SYSTEM_SECURITY: Self

ACCESS_SYSTEM_SECURITY: read and change the file’s system ACL. A caller the kernel does not allow it gets the kernel’s error from the open.

Source§

impl FileRights

Source

pub const NONE: Self

No rights beyond the data access.

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 right of other is in this set.

Source

pub const fn is_empty(self) -> bool

Whether the set holds no right.

Trait Implementations§

Source§

impl BitOr for FileRights

Source§

type Output = FileRights

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitOrAssign for FileRights

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl Clone for FileRights

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 FileRights

Source§

impl Debug for FileRights

Source§

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

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

impl Default for FileRights

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for FileRights

Source§

impl Hash for FileRights

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 FileRights

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 FileRights

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.