Struct glommio::io::OpenOptions [−][src]
pub struct OpenOptions { /* fields omitted */ }
Expand description
Options and flags which can be used to configure how a file is opened.
This builder exposes the ability to configure how a DmaFile
is opened
and what operations are permitted on the open file.
The DmaFile::open
and DmaFile::create
methods are aliases for
commonly used options using this builder.
Implementations
Creates a blank new set of options ready for configuration.
All options are initially set to false.
Sets the option for read access.
This option, when true, will indicate that the file should be read-able if opened.
Sets the option for write access.
This option, when true, will indicate that the file should be write-able if opened.
If the file already exists, any write calls on it will overwrite its contents, without truncating it.
Sets the option for appending a previous file.
If a file is successfully opened with this option set it will append new data at the end of it.
The file must be opened with write access for append to work.
Sets the option for truncating a previous file.
If a file is successfully opened with this option set it will truncate the file to 0 length if it already exists.
The file must be opened with write access for truncate to work.
Sets the option to create a new file, or open it if it already exists.
In order for the file to be created, OpenOptions::write
access
must be used.
Sets the option to create a new file, failing if it already exists.
No file is allowed to exist at the target location, also no (dangling) symlink. In this way, if the call succeeds, the file returned is guaranteed to be new.
This option is useful because it is atomic. Otherwise between checking whether a file exists and creating a new one, the file may have been created by another process (a TOCTOU race condition / attack).
If .create_new(true)
is set, .create()
and .truncate()
are
ignored.
The file must be opened with write or append access in order to create a new file.
Pass custom flags to the flags argument of open_at
.
Sets the mode bits that a new file will be created with.
Similiar to OpenOptions::open()
in the standard library, but returns a
DMA file
Similiar to OpenOptions::open()
in the standard library, but returns a
Buffered file
Trait Implementations
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
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more