pub struct VirtioFsWriter<'a, S = ()> { /* private fields */ }Expand description
Provide high-level interface over the sequence of memory regions defined by writable descriptors in the Virtio descriptor chain.
Note that virtio spec requires driver to place any device-writable descriptors after any device-readable descriptors (2.6.4.2 in Virtio Spec v1.1). Writer will start iterating the descriptors from the first writable one and will assume that all following descriptors are writable.
Implementations§
Source§impl<'a, S: BitmapSlice> VirtioFsWriter<'a, S>
impl<'a, S: BitmapSlice> VirtioFsWriter<'a, S>
Sourcepub async fn async_write(&mut self, data: &[u8]) -> Result<usize>
pub async fn async_write(&mut self, data: &[u8]) -> Result<usize>
Write data from a buffer into this writer in asynchronous mode.
Sourcepub async fn async_write2(&mut self, data: &[u8], data2: &[u8]) -> Result<usize>
pub async fn async_write2(&mut self, data: &[u8], data2: &[u8]) -> Result<usize>
Write data from two buffers into this writer in asynchronous mode.
Sourcepub async fn async_write3(
&mut self,
data: &[u8],
data2: &[u8],
data3: &[u8],
) -> Result<usize>
pub async fn async_write3( &mut self, data: &[u8], data2: &[u8], data3: &[u8], ) -> Result<usize>
Write data from three buffers into this writer in asynchronous mode.
Sourcepub async fn async_write_all(&mut self, buf: &[u8]) -> Result<()>
pub async fn async_write_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer in asynchronous mode.
Sourcepub async fn async_write_from_at<F: AsyncFileReadWriteVolatile>(
&mut self,
src: &F,
count: usize,
off: u64,
) -> Result<usize>
pub async fn async_write_from_at<F: AsyncFileReadWriteVolatile>( &mut self, src: &F, count: usize, off: u64, ) -> Result<usize>
Writes data to the descriptor chain buffer from a File at offset off.
Returns the number of bytes written to the descriptor chain buffer.
Source§impl<'a> VirtioFsWriter<'a>
impl<'a> VirtioFsWriter<'a>
Sourcepub fn new<M>(
mem: &'a M::Target,
desc_chain: DescriptorChain<M>,
) -> Result<VirtioFsWriter<'a, MS<'a, M::Target>>>
pub fn new<M>( mem: &'a M::Target, desc_chain: DescriptorChain<M>, ) -> Result<VirtioFsWriter<'a, MS<'a, M::Target>>>
Construct a new Writer wrapper over desc_chain.
Source§impl<'a, S: BitmapSlice> VirtioFsWriter<'a, S>
impl<'a, S: BitmapSlice> VirtioFsWriter<'a, S>
Sourcepub fn write_obj<T: ByteValued>(&mut self, val: T) -> Result<()>
pub fn write_obj<T: ByteValued>(&mut self, val: T) -> Result<()>
Write an object to the descriptor chain buffer.
Sourcepub fn write_from<F: FileReadWriteVolatile>(
&mut self,
src: F,
count: usize,
) -> Result<usize>
pub fn write_from<F: FileReadWriteVolatile>( &mut self, src: F, count: usize, ) -> Result<usize>
Write data to the descriptor chain buffer from a file descriptor.
Return the number of bytes written to the descriptor chain buffer.
Sourcepub fn write_from_at<F: FileReadWriteVolatile>(
&mut self,
src: F,
count: usize,
off: u64,
) -> Result<usize>
pub fn write_from_at<F: FileReadWriteVolatile>( &mut self, src: F, count: usize, off: u64, ) -> Result<usize>
Write data to the descriptor chain buffer from a File at offset off.
Return the number of bytes written to the descriptor chain buffer.
Sourcepub fn write_all_from<F: FileReadWriteVolatile>(
&mut self,
src: F,
count: usize,
) -> Result<()>
pub fn write_all_from<F: FileReadWriteVolatile>( &mut self, src: F, count: usize, ) -> Result<()>
Write all data to the descriptor chain buffer from a file descriptor.
Sourcepub fn available_bytes(&self) -> usize
pub fn available_bytes(&self) -> usize
Return number of bytes available for writing.
May return an error if the combined lengths of all the buffers in the DescriptorChain would cause an overflow.
Sourcepub fn bytes_written(&self) -> usize
pub fn bytes_written(&self) -> usize
Return number of bytes already written to the descriptor chain buffer.
Sourcepub fn split_at(&mut self, offset: usize) -> Result<Self>
pub fn split_at(&mut self, offset: usize) -> Result<Self>
Split this Writer into two at the given offset in the DescriptorChain buffer.
After the split, self will be able to write up to offset bytes while the returned
Writer can write up to available_bytes() - offset bytes. Returns an error if
offset > self.available_bytes().
Trait Implementations§
Source§impl<'a, S: Clone> Clone for VirtioFsWriter<'a, S>
impl<'a, S: Clone> Clone for VirtioFsWriter<'a, S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a, S: BitmapSlice> From<VirtioFsWriter<'a, S>> for Writer<'a, S>
impl<'a, S: BitmapSlice> From<VirtioFsWriter<'a, S>> for Writer<'a, S>
Source§fn from(w: VirtioFsWriter<'a, S>) -> Self
fn from(w: VirtioFsWriter<'a, S>) -> Self
Source§impl<S: BitmapSlice> Write for VirtioFsWriter<'_, S>
impl<S: BitmapSlice> Write for VirtioFsWriter<'_, S>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)