#[non_exhaustive]pub enum FileAccessMode {
Read,
Write,
WriteTruncate,
WriteAppend,
ReadWrite,
ReadWriteTruncate,
}
Expand description
Access mode
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Read
Opens the file in read-only mode.
FileDescriptor mode: “r”
Write
Opens the file in write-only mode.
This may or may not truncate existing contents.
So please use FileAccessMode::WriteTruncate
or FileAccessMode::WriteAppend
instead.
FileDescriptor mode: “w”
WriteTruncate
Opens the file in write-only mode. The existing content is truncated (deleted), and new data is written from the beginning. Creates a new file if it does not exist.
FileDescriptor mode: “wt”
WriteAppend
Opens the file in write-only mode. The existing content is preserved, and new data is appended to the end of the file. Creates a new file if it does not exist.
FileDescriptor mode: “wa”
ReadWrite
Opens the file in read-write mode.
FileDescriptor mode: “rw”
ReadWriteTruncate
Opens the file in read-write mode. The existing content is truncated (deleted), and new data is written from the beginning. Creates a new file if it does not exist.
FileDescriptor mode: “rwt”
Trait Implementations§
Source§impl Clone for FileAccessMode
impl Clone for FileAccessMode
Source§fn clone(&self) -> FileAccessMode
fn clone(&self) -> FileAccessMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more