pub enum Mode {
Read,
Replace,
Append,
ReadReplace,
ReadAppend,
}
Expand description
The mode of opening the file. Describes what you are permitted to do with it.
Read: permission to read the file only.
Replace: permission wipe the file and replace its contents.
Append: permission to add content to the end of the file.
ReadReplace: permission to read the file, and also to wipe the file and replace its contents.
ReadAppend: permission to read the file, and also to add content to the end of the file.
Read, ReadReplace, ReadAppend are read
-able.
Replace, Append, ReadReplace, ReadAppend are write
-able.
Variants§
Implementations§
Source§impl Mode
impl Mode
Sourcepub fn readable(&self) -> bool
pub fn readable(&self) -> bool
match self {
Self::Read | Self::ReadReplace | Self::ReadAppend => true,
_ => false,
}
Sourcepub fn writable(&self) -> bool
pub fn writable(&self) -> bool
match self {
Self::Replace | Self::Append | Self::ReadAppend | Self::ReadReplace => true,
_ => false,
}
Sourcepub fn appendable(&self) -> bool
pub fn appendable(&self) -> bool
match self {
Self::Append | Self::ReadAppend => true,
_ => false,
}
Trait Implementations§
impl Copy for Mode
impl StructuralPartialEq for Mode
Auto Trait Implementations§
impl Freeze for Mode
impl RefUnwindSafe for Mode
impl Send for Mode
impl Sync for Mode
impl Unpin for Mode
impl UnwindSafe for Mode
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