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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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