Trait fuse_backend_rs::api::filesystem::ZeroCopyReader
source · pub trait ZeroCopyReader: Read {
// Required method
fn read_to(
&mut self,
f: &mut dyn FileReadWriteVolatile,
count: usize,
off: u64
) -> Result<usize>;
// Provided methods
fn read_exact_to(
&mut self,
f: &mut dyn FileReadWriteVolatile,
count: usize,
off: u64
) -> Result<()> { ... }
fn copy_to_end(
&mut self,
f: &mut dyn FileReadWriteVolatile,
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§
sourcefn read_to(
&mut self,
f: &mut dyn FileReadWriteVolatile,
count: usize,
off: u64
) -> Result<usize>
fn read_to( &mut self, f: &mut dyn FileReadWriteVolatile, 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:
- There is no more data left in
self. - There is no more space in
f. countwas0.
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§
sourcefn read_exact_to(
&mut self,
f: &mut dyn FileReadWriteVolatile,
count: usize,
off: u64
) -> Result<()>
fn read_exact_to( &mut self, f: &mut dyn FileReadWriteVolatile, 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.
sourcefn copy_to_end(
&mut self,
f: &mut dyn FileReadWriteVolatile,
off: u64
) -> Result<usize>
fn copy_to_end( &mut self, f: &mut dyn FileReadWriteVolatile, 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.