pub trait WriteAt: Array {
fn write_at(&mut self, buf: &[u8], offset: u64) -> Result<usize>;
fn write_all_at(&mut self, buf: &[u8], offset: u64) -> Result<()>;
fn write_vectored_at(
&mut self,
bufs: &[IoSlice<'_>],
offset: u64
) -> Result<usize>;
fn write_all_vectored_at(
&mut self,
bufs: &mut [IoSlice<'_>],
offset: u64
) -> Result<()>;
fn is_write_vectored_at(&self) -> bool;
fn copy_from<R: ReadAt>(
&mut self,
offset: u64,
input: &R,
input_offset: u64,
len: u64
) -> Result<u64>;
fn set_len(&mut self, size: u64) -> Result<()>;
}
Expand description
A trait for writing to arrays.
This is similar to std::io::Write
except all of the reading functions
take an offset
parameter, specifying a position in the array to read at.
Required Methods
Writes a number of bytes starting from a given offset.
This is similar to std::os::unix::fs::FileExt::write_at
, except it
takes self
by immutable reference since the entire side effect is
I/O, and it’s supported on non-Unix platforms including Windows.
Attempts to write an entire buffer starting from a given offset.
This is similar to std::os::unix::fs::FileExt::write_all_at
, except
it takes self
by immutable reference since the entire side effect is
I/O, and it’s supported on non-Unix platforms including Windows.
Is to write_vectored
what write_at
is to write
.
Is to write_all_vectored
what write_all_at
is to write_all
.
fn is_write_vectored_at(&self) -> bool
fn is_write_vectored_at(&self) -> bool
Determines if Self
has an efficient write_vectored_at
implementation.
Copy len
bytes from input
at input_offset
to self
at offset
.