pub trait FileExt {
// Required methods
fn size(&self) -> Result<u64>;
fn preallocate(&self, len: u64) -> Result<()>;
fn advise_random_access(&self) -> Result<()>;
fn advise_sequential_access(&self) -> Result<()>;
fn disable_cache(&self) -> Result<()>;
fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<()>;
fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<()>;
}
Expand description
Extension convenience trait that allows pre-allocating files, suggesting random access pattern and doing cross-platform exact reads/writes
Required Methods§
sourcefn preallocate(&self, len: u64) -> Result<()>
fn preallocate(&self, len: u64) -> Result<()>
Make sure file has specified number of bytes allocated for it
sourcefn advise_random_access(&self) -> Result<()>
fn advise_random_access(&self) -> Result<()>
Advise OS/file system that file will use random access and read-ahead behavior is
undesirable, on Windows this can only be set when file is opened, see OpenOptionsExt
sourcefn advise_sequential_access(&self) -> Result<()>
fn advise_sequential_access(&self) -> Result<()>
Advise OS/file system that file will use sequential access and read-ahead behavior is
desirable, on Windows this can only be set when file is opened, see OpenOptionsExt
sourcefn disable_cache(&self) -> Result<()>
fn disable_cache(&self) -> Result<()>
Disable cache on macOS