FileMode

Enum FileMode 

Source
#[non_exhaustive]
pub enum FileMode { Dir { permissions: u16, }, Regular { permissions: u16, }, Invalid { raw_mode: i32, reason: &'static str, }, }

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Dir

Fields

§permissions: u16
§

Regular

Fields

§permissions: u16
§

Invalid

Fields

§raw_mode: i32
§reason: &'static str

Implementations§

Source§

impl FileMode

Source

pub fn regular(permissions: u16) -> Self

Create a new Regular instance. permissions can be between 0 and 0o7777. Values greater will be set to 0o7777.

Source

pub fn dir(permissions: u16) -> Self

Create a new Dir instance. permissions can be between 0 and 0o7777. Values greater will be set to 0o7777.

Source

pub fn try_from_raw(raw: i32) -> Result<Self, RPMError>

Usually this should be done with TryFrom, but since we already have a From implementation, we run into this issue: https://github.com/rust-lang/rust/issues/50133

Source

pub fn to_result(self) -> Result<Self, RPMError>

Turns this FileMode into a result. If the mode is Invalid, it will be converted into RPMError::InvalidFileMode. Otherwise it is Ok(self).

Source

pub fn raw_mode(&self) -> u16

Returns the complete file mode (type and permissions)

Source

pub fn file_type(&self) -> u16

Source

pub fn permissions(&self) -> u16

Trait Implementations§

Source§

impl Clone for FileMode

Source§

fn clone(&self) -> FileMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FileMode

Source§

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

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

impl From<i16> for FileMode

Source§

fn from(raw: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for FileMode

Source§

fn from(raw_mode: i32) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for FileMode

Source§

fn from(raw_mode: u16) -> Self

Converts to this type from the input type.
Source§

impl Hash for FileMode

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 Into<i16> for FileMode

Source§

fn into(self) -> i16

Converts this type into the (usually inferred) input type.
Source§

impl Into<i32> for FileMode

Source§

fn into(self) -> i32

Converts this type into the (usually inferred) input type.
Source§

impl Into<u16> for FileMode

Source§

fn into(self) -> u16

Converts this type into the (usually inferred) input type.
Source§

impl Into<u32> for FileMode

Source§

fn into(self) -> u32

Converts this type into the (usually inferred) input type.
Source§

impl PartialEq for FileMode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for FileMode

Source§

impl Eq for FileMode

Source§

impl StructuralPartialEq for FileMode

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

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

Source§

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

Source§

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

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V