Struct cap_primitives::fs::OpenOptions
source · [−]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
.
Note that this OpenOptions
has no open
method. To open a file with
an OptionOptions
, you must first obtain a Dir
containing the path,
and then call Dir::open_with
.
Implementations
sourceimpl OpenOptions
impl OpenOptions
sourcepub const fn new() -> Self
pub const fn new() -> Self
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 Self
pub fn read(&mut self, read: bool) -> &mut Self
Sets the option for read access.
This corresponds to std::fs::OpenOptions::read
.
sourcepub fn write(&mut self, write: bool) -> &mut Self
pub fn write(&mut self, write: bool) -> &mut Self
Sets the option for write access.
This corresponds to std::fs::OpenOptions::write
.
sourcepub fn append(&mut self, append: bool) -> &mut Self
pub fn append(&mut self, append: bool) -> &mut Self
Sets the option for the append mode.
This corresponds to std::fs::OpenOptions::append
.
sourcepub fn truncate(&mut self, truncate: bool) -> &mut Self
pub fn truncate(&mut self, truncate: bool) -> &mut Self
Sets the option for truncating a previous file.
This corresponds to std::fs::OpenOptions::truncate
.
sourcepub fn create(&mut self, create: bool) -> &mut Self
pub fn create(&mut self, create: bool) -> &mut Self
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 Self
pub fn create_new(&mut self, create_new: bool) -> &mut Self
Sets the option to always create a new file.
This corresponds to std::fs::OpenOptions::create_new
.
Trait Implementations
sourceimpl Clone for OpenOptions
impl Clone for OpenOptions
sourcefn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for OpenOptions
impl Debug for OpenOptions
sourceimpl OpenOptionsExt for OpenOptions
impl OpenOptionsExt for OpenOptions
To prevent race conditions on Windows, handles for directories must be
opened without FILE_SHARE_DELETE
.
sourcefn access_mode(&mut self, access: u32) -> &mut Self
fn access_mode(&mut self, access: u32) -> &mut Self
Overrides the dwDesiredAccess
argument to the call to CreateFile
with the specified value. Read more
sourcefn custom_flags(&mut self, flags: u32) -> &mut Self
fn custom_flags(&mut self, flags: u32) -> &mut Self
Sets extra flags for the 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
). Read more
sourcefn attributes(&mut self, val: u32) -> &mut Self
fn attributes(&mut self, val: u32) -> &mut Self
Sets the 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
). Read more
sourcefn security_qos_flags(&mut self, flags: u32) -> &mut Self
fn security_qos_flags(&mut self, flags: u32) -> &mut Self
Sets the 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
). Read more
Auto Trait Implementations
impl RefUnwindSafe for OpenOptions
impl Send for OpenOptions
impl Sync for OpenOptions
impl Unpin for OpenOptions
impl UnwindSafe for OpenOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more