pub trait WriteAt: Array {
// Required methods
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§
Sourcefn write_at(&mut self, buf: &[u8], offset: u64) -> Result<usize>
fn write_at(&mut self, buf: &[u8], offset: u64) -> Result<usize>
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.
Sourcefn write_all_at(&mut self, buf: &[u8], offset: u64) -> Result<()>
fn write_all_at(&mut self, buf: &[u8], offset: u64) -> Result<()>
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.
Sourcefn write_vectored_at(
&mut self,
bufs: &[IoSlice<'_>],
offset: u64,
) -> Result<usize>
fn write_vectored_at( &mut self, bufs: &[IoSlice<'_>], offset: u64, ) -> Result<usize>
Is to write_vectored
what write_at
is to write
.
Sourcefn write_all_vectored_at(
&mut self,
bufs: &mut [IoSlice<'_>],
offset: u64,
) -> Result<()>
fn write_all_vectored_at( &mut self, bufs: &mut [IoSlice<'_>], offset: u64, ) -> Result<()>
Is to write_all_vectored
what write_all_at
is to write_all
.
Sourcefn is_write_vectored_at(&self) -> bool
fn is_write_vectored_at(&self) -> bool
Determines if Self
has an efficient write_vectored_at
implementation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.