#[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.
Implementations§
Source§impl FileMode
impl FileMode
Sourcepub fn regular(permissions: u16) -> Self
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.
Sourcepub fn dir(permissions: u16) -> Self
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.
Sourcepub fn try_from_raw(raw: i32) -> Result<Self, RPMError>
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
Sourcepub fn to_result(self) -> Result<Self, RPMError>
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).
pub fn file_type(&self) -> u16
pub fn permissions(&self) -> u16
Trait Implementations§
impl Copy for FileMode
impl Eq for FileMode
impl StructuralPartialEq for FileMode
Auto Trait Implementations§
impl Freeze for FileMode
impl RefUnwindSafe for FileMode
impl Send for FileMode
impl Sync for FileMode
impl Unpin for FileMode
impl UnwindSafe for FileMode
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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