Trait fuse::filesystem::ZeroCopyWriter
source · pub trait ZeroCopyWriter {
// Required method
fn write_from(
&mut self,
f: &mut File,
count: usize,
off: u64
) -> Result<usize>;
// Provided methods
fn write_all_from(
&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 a File
into the fuse transport without first storing
it in an intermediate buffer.
Required Methods§
sourcefn write_from(&mut self, f: &mut File, count: usize, off: u64) -> Result<usize>
fn write_from(&mut self, f: &mut 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 3 possibilities:
- There is no more data left in
f
. - There is no more space in
self
. count
was0
.
§Errors
If any error is returned then the implementation must guarantee that no bytes were copied
from f
. If the underlying read from f
returns 0
then the implementation must return an
error of the kind io::ErrorKind::UnexpectedEof
.
Provided Methods§
sourcefn write_all_from(&mut self, f: &mut File, count: usize, off: u64) -> Result<()>
fn write_all_from(&mut self, f: &mut File, count: usize, off: u64) -> Result<()>
Copies exactly count
bytes of data from f
at offset off
into self
. 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
well never be more than count
.
sourcefn copy_to_end(&mut self, f: &mut File, off: u64) -> Result<usize>
fn copy_to_end(&mut self, f: &mut File, off: u64) -> Result<usize>
Copies all remaining bytes from f
at offset off
into self
. Equivalent to repeatedly
calling write_from
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 f
is unspecified.