pub struct OpenOptions { /* private fields */ }
Expand description
Options and flags which can be used to configure how a file is opened.
This corresponds to std::fs::OpenOptions
.
This OpenOptions
has no open
method. To open a file with an
OptionOptions
, first obtain a Dir
containing the path, and then call
Dir::open_with
.
Implementations§
Source§impl OpenOptions
impl OpenOptions
Sourcepub const fn new() -> OpenOptions
pub const fn new() -> OpenOptions
Creates a blank new set of options ready for configuration.
This corresponds to std::fs::OpenOptions::new
.
Sourcepub fn read(&mut self, read: bool) -> &mut OpenOptions
pub fn read(&mut self, read: bool) -> &mut OpenOptions
Sets the option for read access.
This corresponds to std::fs::OpenOptions::read
.
Sourcepub fn write(&mut self, write: bool) -> &mut OpenOptions
pub fn write(&mut self, write: bool) -> &mut OpenOptions
Sets the option for write access.
This corresponds to std::fs::OpenOptions::write
.
Sourcepub fn append(&mut self, append: bool) -> &mut OpenOptions
pub fn append(&mut self, append: bool) -> &mut OpenOptions
Sets the option for the append mode.
This corresponds to std::fs::OpenOptions::append
.
Sourcepub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions
pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions
Sets the option for truncating a previous file.
This corresponds to std::fs::OpenOptions::truncate
.
Sourcepub fn create(&mut self, create: bool) -> &mut OpenOptions
pub fn create(&mut self, create: bool) -> &mut OpenOptions
Sets the option to create a new file.
This corresponds to std::fs::OpenOptions::create
.
Sourcepub fn create_new(&mut self, create_new: bool) -> &mut OpenOptions
pub fn create_new(&mut self, create_new: bool) -> &mut OpenOptions
Sets the option to always create a new file.
This corresponds to std::fs::OpenOptions::create_new
.
Trait Implementations§
Source§impl Clone for OpenOptions
impl Clone for OpenOptions
Source§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for OpenOptions
impl Debug for OpenOptions
Source§impl OpenOptionsExt for OpenOptions
impl OpenOptionsExt for OpenOptions
To prevent race conditions on Windows, handles for directories must be
opened without FILE_SHARE_DELETE
.
Source§fn access_mode(&mut self, access: u32) -> &mut OpenOptions
fn access_mode(&mut self, access: u32) -> &mut OpenOptions
dwDesiredAccess
argument to the call to [CreateFile
]
with the specified value.Source§fn custom_flags(&mut self, flags: u32) -> &mut OpenOptions
fn custom_flags(&mut self, flags: u32) -> &mut OpenOptions
dwFileFlags
argument to the call to
CreateFile2
to the specified value (or combines it with
attributes
and security_qos_flags
to set the dwFlagsAndAttributes
for CreateFile
).Source§fn attributes(&mut self, val: u32) -> &mut OpenOptions
fn attributes(&mut self, val: u32) -> &mut OpenOptions
dwFileAttributes
argument to the call to CreateFile2
to
the specified value (or combines it with custom_flags
and
security_qos_flags
to set the dwFlagsAndAttributes
for
CreateFile
).Source§fn security_qos_flags(&mut self, flags: u32) -> &mut OpenOptions
fn security_qos_flags(&mut self, flags: u32) -> &mut OpenOptions
dwSecurityQosFlags
argument to the call to CreateFile2
to
the specified value (or combines it with custom_flags
and attributes
to set the dwFlagsAndAttributes
for CreateFile
).