Struct tokio::fs::file::OpenOptions
source · pub struct OpenOptions(_);
Expand description
Options and flags which can be used to configure how a file is opened.
This is a specialized version of std::fs::OpenOptions
for usage from
the Tokio runtime.
From<std::fs::OpenOptions>
is implemented for more advanced configuration
than the methods provided here.
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
.
Examples
ⓘ
use tokio::fs::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
See the underlying read
call for details.
sourcepub fn write(&mut self, write: bool) -> &mut OpenOptions
pub fn write(&mut self, write: bool) -> &mut OpenOptions
See the underlying write
call for details.
sourcepub fn append(&mut self, append: bool) -> &mut OpenOptions
pub fn append(&mut self, append: bool) -> &mut OpenOptions
See the underlying append
call for details.
sourcepub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions
pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions
See the underlying truncate
call for details.
sourcepub fn create(&mut self, create: bool) -> &mut OpenOptions
pub fn create(&mut self, create: bool) -> &mut OpenOptions
See the underlying create
call for details.
sourcepub fn create_new(&mut self, create_new: bool) -> &mut OpenOptions
pub fn create_new(&mut self, create_new: bool) -> &mut OpenOptions
See the underlying create_new
call for details.
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 From<OpenOptions> for OpenOptions
impl From<OpenOptions> for OpenOptions
source§fn from(options: OpenOptions) -> OpenOptions
fn from(options: OpenOptions) -> OpenOptions
Converts to this type from the input type.