Struct fs_err::tokio::OpenOptions
source · pub struct OpenOptions { /* private fields */ }
tokio
only.Expand description
Options and flags which can be used to configure how a file is opened.
This is a wrapper around tokio::fs::OpenOptions
.
Implementations§
source§impl OpenOptions
impl OpenOptions
sourcepub fn new() -> OpenOptions
pub fn new() -> OpenOptions
Creates a blank new set of options ready for configuration.
All options are initially set to false
.
This is a wrapped version of tokio::fs::OpenOptions::new
Examples
use fs_err::tokio::OpenOptions;
let mut options = OpenOptions::new();
let future = options.read(true).open("foo.txt");
sourcepub fn read(&mut self, read: bool) -> &mut OpenOptions
pub fn read(&mut self, read: bool) -> &mut OpenOptions
Sets the option for read access.
Wrapper for tokio::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.
Wrapper for tokio::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.
Wrapper for tokio::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.
Wrapper for tokio::fs::OpenOptions::truncate
.
sourcepub fn create(&mut self, create: bool) -> &mut OpenOptions
pub fn create(&mut self, create: bool) -> &mut OpenOptions
Sets the option for creating a new file.
Wrapper for tokio::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.
Wrapper for tokio::fs::OpenOptions::create_new
.
source§impl OpenOptions
impl OpenOptions
sourcepub fn mode(&mut self, mode: u32) -> &mut OpenOptions
pub fn mode(&mut self, mode: u32) -> &mut OpenOptions
Sets the mode bits that a new file will be created with.
Wrapper for tokio::fs::OpenOptions::mode
.
sourcepub fn custom_flags(&mut self, flags: i32) -> &mut OpenOptions
pub fn custom_flags(&mut self, flags: i32) -> &mut OpenOptions
Passes custom flags to the flags
argument of open
.
Wrapper for tokio::fs::OpenOptions::custom_flags
.
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 more