Trait base::file_traits::FileReadWriteAtVolatile
source · pub trait FileReadWriteAtVolatile {
// Required methods
fn read_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<usize>;
fn write_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<usize>;
// Provided methods
fn read_vectored_at_volatile(
&self,
bufs: &[VolatileSlice<'_>],
offset: u64
) -> Result<usize> { ... }
fn read_exact_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<()> { ... }
fn write_vectored_at_volatile(
&self,
bufs: &[VolatileSlice<'_>],
offset: u64
) -> Result<usize> { ... }
fn write_all_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<()> { ... }
}
Expand description
A trait similar to the unix ReadExt
and WriteExt
traits, but for volatile memory.
Required Methods§
sourcefn read_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<usize>
fn read_at_volatile( &self, slice: VolatileSlice<'_>, offset: u64 ) -> Result<usize>
Reads bytes from this file at offset
into the given slice, returning the number of bytes
read on success. On Windows file pointer will update with the read, but on Linux the
file pointer will not change.
sourcefn write_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<usize>
fn write_at_volatile( &self, slice: VolatileSlice<'_>, offset: u64 ) -> Result<usize>
Writes bytes to this file at offset
from the given slice, returning the number of bytes
written on success. On Windows file pointer will update with the write, but on Linux the
file pointer will not change.
Provided Methods§
sourcefn read_vectored_at_volatile(
&self,
bufs: &[VolatileSlice<'_>],
offset: u64
) -> Result<usize>
fn read_vectored_at_volatile( &self, bufs: &[VolatileSlice<'_>], offset: u64 ) -> Result<usize>
Like read_at_volatile
, except it reads to a slice of buffers. Data is copied to fill each
buffer in order, with the final buffer written to possibly being only partially filled. This
method must behave as a single call to read_at_volatile
with the buffers concatenated
would. The default implementation calls read_at_volatile
with either the first nonempty
buffer provided, or returns Ok(0)
if none exists.
On Windows file pointer will update with the read, but on Linux the file pointer will not
change.
sourcefn read_exact_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<()>
fn read_exact_at_volatile( &self, slice: VolatileSlice<'_>, offset: u64 ) -> Result<()>
Reads bytes from this file at offset
into the given slice until all bytes in the slice are
read, or an error is returned. On Windows file pointer will update with the read, but on
Linux the file pointer will not change.
sourcefn write_vectored_at_volatile(
&self,
bufs: &[VolatileSlice<'_>],
offset: u64
) -> Result<usize>
fn write_vectored_at_volatile( &self, bufs: &[VolatileSlice<'_>], offset: u64 ) -> Result<usize>
Like write_at_volatile
, except that it writes from a slice of buffers. Data is copied
from each buffer in order, with the final buffer read from possibly being only partially
consumed. This method must behave as a call to write_at_volatile
with the buffers
concatenated would. The default implementation calls write_at_volatile
with either the
first nonempty buffer provided, or returns Ok(0)
if none exists.
On Windows file pointer will update with the write, but on Linux the file pointer will not
change.
sourcefn write_all_at_volatile(
&self,
slice: VolatileSlice<'_>,
offset: u64
) -> Result<()>
fn write_all_at_volatile( &self, slice: VolatileSlice<'_>, offset: u64 ) -> Result<()>
Writes bytes to this file at offset
from the given slice until all bytes in the slice
are written, or an error is returned. On Windows file pointer will update with the write,
but on Linux the file pointer will not change.