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
sourceimpl 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
sourceimpl Clone for OpenOptions
impl Clone for OpenOptions
sourcepub fn clone(&self) -> OpenOptions
pub 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 From<OpenOptions> for OpenOptions
impl From<OpenOptions> for OpenOptions
sourcepub fn from(options: OpenOptions) -> OpenOptions
pub fn from(options: OpenOptions) -> OpenOptions
Performs the conversion.
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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more