pub struct SendFile {
pub file: RawFd,
pub count: usize,
pub offset: off_t,
}
Abstraction for interacting with Linux's zero-copy I/O sendfile syscall.
let mut sendfile = SendFile::new(source, count)?;
loop {
match sendfile.send(dest)? {
0 => return Ok(()),
_ => ()
}
}
Set a file to be used as the sendfile source.
Set the number of bytes to write per call.
Set the offset to begin copying bytes from.
Begin copying from the the sendfile to the destination file.
- This will write up to
self.count
amount of bytes at a time.
- The
self.offset
value is updated by the syscall on return.
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static