pub struct OpenOptions {
pub read: bool,
pub write: bool,
pub create: bool,
pub create_new: bool,
pub truncate: bool,
pub append: bool,
}Expand description
Options for opening a file.
This struct provides a builder-style API for configuring how a file
should be opened, similar to std::fs::OpenOptions.
Fields§
§read: boolOpen file for reading.
write: boolOpen file for writing.
create: boolCreate the file if it doesn’t exist.
create_new: boolCreate a new file, failing if it already exists.
truncate: boolTruncate the file to zero length.
append: boolAppend to the end of the file.
Implementations§
Source§impl OpenOptions
impl OpenOptions
Sourcepub fn create_new(self, create_new: bool) -> Self
pub fn create_new(self, create_new: bool) -> Self
Set the create_new flag.
Sourcepub fn create_write() -> Self
pub fn create_write() -> Self
Create options for creating and writing a new file (truncating if exists).
Sourcepub fn read_write() -> Self
pub fn read_write() -> Self
Create options for read and write access.
Sourcepub fn create_new_write() -> Self
pub fn create_new_write() -> Self
Create options for creating a new file for writing (fails if exists).
Trait Implementations§
Source§impl Clone for OpenOptions
impl Clone for OpenOptions
Source§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
Returns a duplicate 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 Default for OpenOptions
impl Default for OpenOptions
Source§fn default() -> OpenOptions
fn default() -> OpenOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OpenOptions
impl RefUnwindSafe for OpenOptions
impl Send for OpenOptions
impl Sync for OpenOptions
impl Unpin for OpenOptions
impl UnsafeUnpin 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