ZeroCopyWriter

Trait ZeroCopyWriter 

Source
pub trait ZeroCopyWriter {
    // Required method
    fn read_from_file_at(
        &mut self,
        f: &File,
        count: usize,
        off: u64,
    ) -> Result<usize>;
}
Expand description

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

Required Methods§

Source

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

Copies at most count bytes from f at offset off directly into self 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 4 possibilities:

  1. There is no more data left in f.
  2. End of f reached.
  3. There is no more space in self.
  4. count was 0.

Does not do short reads, unless one of the above happens; i.e. will invoke the underlying file read function until count bytes have been read or it returns 0 (cases 1 or 2 above) or self has no more space (case 2 above).

Implementations on Foreign Types§

Source§

impl<W: ZeroCopyWriter> ZeroCopyWriter for &mut W

Source§

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

Implementors§