Struct rsfs::disk::OpenOptions
[−]
[src]
pub struct OpenOptions(_);
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
impl Clone for OpenOptions
[src]
fn clone(&self) -> OpenOptions
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for OpenOptions
[src]
impl OpenOptions for OpenOptions
[src]
type File = File
The File
type in the module implementing this trait.
fn read(&mut self, read: bool) -> &mut Self
Sets the option for read access. Read more
fn write(&mut self, write: bool) -> &mut Self
Sets the option for write access. Read more
fn append(&mut self, append: bool) -> &mut Self
Sets the option for append mode. Read more
fn truncate(&mut self, truncate: bool) -> &mut Self
Sets the option for truncating an existing file. Read more
fn create(&mut self, create: bool) -> &mut Self
Sets the option to create the file if it does not exist. Read more
fn create_new(&mut self, create_new: bool) -> &mut Self
Sets the option to always create a new file. Read more
fn open<P: AsRef<Path>>(&self, path: P) -> Result<Self::File>
Opens a file at path
with options specified by self
. Read more