pub trait WriteAt {
fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize>;
fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<()> { ... }
}
Expand description
The WriteAt
trait allows for writing bytes to a source at a given offset.
Additionally, the methods of this trait only require a shared reference, which makes it ideal for parallel use.
Required methods
Writes a number of bytes starting from a given offset.
Returns the number of bytes written.
The offset is relative to the start of the file and thus independent from the current cursor.
The current file cursor is not affected by this function.
Note that similar to io::Write::write
, it is not an error to return a
short write.
Provided methods
Attempts to write an entire buffer starting from a given offset.
The offset is relative to the start of the file and thus independent from the current cursor.
The current file cursor is not affected by this function.
Errors
This function will return the first error of
non-io::ErrorKind::Interrupted
kind that write_at
returns.