pub struct OpenOptions(/* private fields */);
Expand description
Options and flags which can be used to configure how a file is opened.
This builder, created from GenFS
s new_openopts
, exposes the ability to configure how a
File
is opened and what operations are permitted on the open file. GenFS
s open_file
and create_file
methods are aliases for commonly used options with this builder.
This builder is a single element tuple containing a std::fs::OpenOptions
that implements
rsfs::OpenOptions
and supports unix extensions.
§Examples
Opening a file to read:
let f = fs.new_openopts()
.read(true)
.open("f")?;
Opening a file for both reading and writing, as well as creating it if it doesn’t exist:
let mut f = fs.new_openopts()
.read(true)
.write(true)
.create(true)
.open("f")?;
Trait Implementations§
Source§impl Clone for OpenOptions
impl Clone for OpenOptions
Source§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for OpenOptions
impl Debug for OpenOptions
Source§impl OpenOptions for OpenOptions
impl OpenOptions for OpenOptions
Source§fn truncate(&mut self, truncate: bool) -> &mut Self
fn truncate(&mut self, truncate: bool) -> &mut Self
Sets the option for truncating an existing file. Read more
Source§fn create(&mut self, create: bool) -> &mut Self
fn create(&mut self, create: bool) -> &mut Self
Sets the option to create the file if it does not exist. Read more
Source§fn create_new(&mut self, create_new: bool) -> &mut Self
fn create_new(&mut self, create_new: bool) -> &mut Self
Sets the option to always create a new file. Read more
Source§impl OpenOptionsExt for OpenOptions
impl OpenOptionsExt for OpenOptions
Auto Trait Implementations§
impl Freeze for OpenOptions
impl RefUnwindSafe for OpenOptions
impl Send for OpenOptions
impl Sync for OpenOptions
impl Unpin for OpenOptions
impl UnwindSafe for OpenOptions
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