pub trait ZeroCopyReader {
    // Required method
    fn read_to(&mut self, f: &mut File, count: usize, off: u64) -> Result<usize>;

    // Provided methods
    fn read_exact_to(
        &mut self,
        f: &mut File,
        count: usize,
        off: u64
    ) -> Result<()> { ... }
    fn copy_to_end(&mut self, f: &mut File, off: u64) -> Result<usize> { ... }
}
Expand description

A trait for directly copying data from the fuse transport into a File without first storing it in an intermediate buffer.

Required Methods§

source

fn read_to(&mut self, f: &mut File, count: usize, off: u64) -> Result<usize>

Copies at most count bytes from self directly into f at offset off without storing it in any intermediate buffers. If the return value is Ok(n) then it must be guaranteed that 0 <= n <= count. If n is 0, then it can indicate one of 3 possibilities:

  1. There is no more data left in self.
  2. There is no more space in f.
  3. count was 0.
§Errors

If any error is returned then the implementation must guarantee that no bytes were copied from self. If the underlying write to f returns 0 then the implementation must return an error of the kind io::ErrorKind::WriteZero.

Provided Methods§

source

fn read_exact_to(&mut self, f: &mut File, count: usize, off: u64) -> Result<()>

Copies exactly count bytes of data from self into f at offset off. off + count must be less than u64::MAX.

§Errors

If an error is returned then the number of bytes copied from self is unspecified but it will never be more than count.

source

fn copy_to_end(&mut self, f: &mut File, off: u64) -> Result<usize>

Copies all remaining bytes from self into f at offset off. Equivalent to repeatedly calling read_to until it returns either Ok(0) or a non-ErrorKind::Interrupted error.

§Errors

If an error is returned then the number of bytes copied from self is unspecified.

Implementations on Foreign Types§

source§

impl<'a, R: ZeroCopyReader> ZeroCopyReader for &'a mut R

source§

fn read_to(&mut self, f: &mut File, count: usize, off: u64) -> Result<usize>

source§

fn read_exact_to(&mut self, f: &mut File, count: usize, off: u64) -> Result<()>

source§

fn copy_to_end(&mut self, f: &mut File, off: u64) -> Result<usize>

Implementors§