Skip to main content

FileExt

Trait FileExt 

Source
pub trait FileExt {
    // Required methods
    fn copy_to(&self, to: &File) -> Result<u64>;
    fn update_timestamps(&self) -> Result<()>;
    fn pread_exact(&self, buf: &mut [u8], position: usize) -> Result<()>;
}
Expand description

Helper functions for std::fs::File

Required Methods§

Source

fn copy_to(&self, to: &File) -> Result<u64>

👎Deprecated:

Use std::io::copy instead

Copy the entire contents of self to to. This uses operating system specific fast paths if available.

Source

fn update_timestamps(&self) -> Result<()>

Update timestamps (both access and modification) to the current time.

Source

fn pread_exact(&self, buf: &mut [u8], position: usize) -> Result<()>

Read the exact number of bytes required to fill buf starting from position, without affecting file offset.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FileExt for File

Source§

fn copy_to(&self, to: &File) -> Result<u64>

👎Deprecated:

Use std::io::copy instead

Source§

fn update_timestamps(&self) -> Result<()>

Source§

fn pread_exact(&self, buf: &mut [u8], start_pos: usize) -> Result<()>

Implementors§