pub trait FileReadWriteVolatile {
    // Required methods
    fn read_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<usize>;
    fn write_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<usize>;
    fn read_at_volatile(
        &mut self,
        slice: FileVolatileSlice<'_>,
        offset: u64,
    ) -> Result<usize>;
    fn write_at_volatile(
        &mut self,
        slice: FileVolatileSlice<'_>,
        offset: u64,
    ) -> Result<usize>;

    // Provided methods
    fn read_vectored_volatile(
        &mut self,
        bufs: &[FileVolatileSlice<'_>],
    ) -> Result<usize> { ... }
    fn read_exact_volatile(
        &mut self,
        slice: FileVolatileSlice<'_>,
    ) -> Result<()> { ... }
    fn write_vectored_volatile(
        &mut self,
        bufs: &[FileVolatileSlice<'_>],
    ) -> Result<usize> { ... }
    fn write_all_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<()> { ... }
    fn read_vectored_at_volatile(
        &mut self,
        bufs: &[FileVolatileSlice<'_>],
        offset: u64,
    ) -> Result<usize> { ... }
    fn read_exact_at_volatile(
        &mut self,
        slice: FileVolatileSlice<'_>,
        offset: u64,
    ) -> Result<()> { ... }
    fn write_vectored_at_volatile(
        &mut self,
        bufs: &[FileVolatileSlice<'_>],
        offset: u64,
    ) -> Result<usize> { ... }
    fn write_all_at_volatile(
        &mut self,
        slice: FileVolatileSlice<'_>,
        offset: u64,
    ) -> Result<()> { ... }
}
Expand description

A trait similar to Read and Write, but uses FileVolatileSlice objects as data buffers.

Required Methods§

source

fn read_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<usize>

Read bytes from this file into the given slice, returning the number of bytes read on success.

source

fn write_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<usize>

Write bytes from the slice to the given file, returning the number of bytes written on success.

source

fn read_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<usize>

Reads bytes from this file at offset into the given slice, returning the number of bytes read on success.

source

fn write_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<usize>

Writes bytes from this file at offset into the given slice, returning the number of bytes written on success.

Provided Methods§

source

fn read_vectored_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], ) -> Result<usize>

Like read_volatile, except it reads to a slice of buffers. Data is copied to fill each buffer in order, with the final buffer written to possibly being only partially filled. This method must behave as a single call to read_volatile with the buffers concatenated would. The default implementation calls read_volatile with either the first nonempty buffer provided, or returns Ok(0) if none exists.

source

fn read_exact_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<()>

Reads bytes from this into the given slice until all bytes in the slice are written, or an error is returned.

source

fn write_vectored_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], ) -> Result<usize>

Like write_volatile, except that it writes from a slice of buffers. Data is copied from each buffer in order, with the final buffer read from possibly being only partially consumed. This method must behave as a call to write_volatile with the buffers concatenated would. The default implementation calls write_volatile with either the first nonempty buffer provided, or returns Ok(0) if none exists.

source

fn write_all_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<()>

Write bytes from the slice to the given file until all the bytes from the slice have been written, or an error is returned.

source

fn read_vectored_at_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], offset: u64, ) -> Result<usize>

Like read_at_volatile, except it reads to a slice of buffers. Data is copied to fill each buffer in order, with the final buffer written to possibly being only partially filled. This method must behave as a single call to read_at_volatile with the buffers concatenated would. The default implementation calls read_at_volatile with either the first nonempty buffer provided, or returns Ok(0) if none exists.

source

fn read_exact_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<()>

Reads bytes from this file at offset into the given slice until all bytes in the slice are read, or an error is returned.

source

fn write_vectored_at_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], offset: u64, ) -> Result<usize>

Like write_at_at_volatile, except that it writes from a slice of buffers. Data is copied from each buffer in order, with the final buffer read from possibly being only partially consumed. This method must behave as a call to write_at_volatile with the buffers concatenated would. The default implementation calls write_at_volatile with either the first nonempty buffer provided, or returns Ok(0) if none exists.

source

fn write_all_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<()>

Writes bytes from this file at offset into the given slice until all bytes in the slice are written, or an error is returned.

Implementations on Foreign Types§

source§

impl FileReadWriteVolatile for File

source§

fn read_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<usize>

source§

fn read_vectored_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], ) -> Result<usize>

source§

fn write_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<usize>

source§

fn write_vectored_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], ) -> Result<usize>

source§

fn read_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<usize>

source§

fn read_vectored_at_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], offset: u64, ) -> Result<usize>

source§

fn write_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<usize>

source§

fn write_vectored_at_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], offset: u64, ) -> Result<usize>

source§

impl<T: FileReadWriteVolatile + ?Sized> FileReadWriteVolatile for &mut T

source§

fn read_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<usize>

source§

fn read_vectored_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], ) -> Result<usize>

source§

fn read_exact_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<()>

source§

fn write_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<usize>

source§

fn write_vectored_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], ) -> Result<usize>

source§

fn write_all_volatile(&mut self, slice: FileVolatileSlice<'_>) -> Result<()>

source§

fn read_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<usize>

source§

fn read_vectored_at_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], offset: u64, ) -> Result<usize>

source§

fn read_exact_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<()>

source§

fn write_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<usize>

source§

fn write_vectored_at_volatile( &mut self, bufs: &[FileVolatileSlice<'_>], offset: u64, ) -> Result<usize>

source§

fn write_all_at_volatile( &mut self, slice: FileVolatileSlice<'_>, offset: u64, ) -> Result<()>

Implementors§