#[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.
Since Android 10, this may or may not truncate existing contents. If the new file is smaller than the old one, this may cause the file to become corrupted. https://issuetracker.google.com/issues/180526528
The reason this is marked as deprecated is because of that behavior, and it is not scheduled to be removed in the future.
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.
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.
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.
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