subspace_farmer_components::file_ext

Trait OpenOptionsExt

source
pub trait OpenOptionsExt {
    // Required methods
    fn advise_random_access(&mut self) -> &mut Self;
    fn advise_sequential_access(&mut self) -> &mut Self;
    fn use_direct_io(&mut self) -> &mut Self;
}
Expand description

Extension convenience trait that allows setting some file opening options in cross-platform way

Required Methods§

source

fn advise_random_access(&mut self) -> &mut Self

Advise OS/file system that file will use random access and read-ahead behavior is undesirable, only has impact on Windows, for other operating systems see FileExt

source

fn advise_sequential_access(&mut self) -> &mut Self

Advise OS/file system that file will use sequential access and read-ahead behavior is desirable, only has impact on Windows, for other operating systems see FileExt

source

fn use_direct_io(&mut self) -> &mut Self

Use Direct I/O on Linux and disable buffering on Windows.

NOTE: There are major alignment requirements described here: https://learn.microsoft.com/en-us/windows/win32/fileio/file-buffering#alignment-and-file-access-requirements https://man7.org/linux/man-pages/man2/open.2.html

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

source§

impl OpenOptionsExt for OpenOptions

source§

fn advise_random_access(&mut self) -> &mut Self

source§

fn advise_sequential_access(&mut self) -> &mut Self

source§

fn use_direct_io(&mut self) -> &mut Self

Implementors§