pub struct PeekedWork<'a> { /* private fields */ }Expand description
A descriptor that has been peeked from a VirtioQueue without advancing
the available index.
The descriptor remains in the available ring until consume
is called, which advances the index and returns a normal
VirtioQueueCallbackWork for completion.
Dropping a PeekedWork without consuming is a no-op — the descriptor stays
available for the next peek/next call.
Implementations§
Source§impl<'a> PeekedWork<'a>
impl<'a> PeekedWork<'a>
Sourcepub fn payload(&self) -> &[VirtioQueuePayload]
pub fn payload(&self) -> &[VirtioQueuePayload]
Returns the payload descriptors.
Sourcepub fn readable_length(&self) -> u64
pub fn readable_length(&self) -> u64
Total length of all readable (guest-written) payload buffers.
Sourcepub fn read(
&self,
mem: &GuestMemory,
target: &mut [u8],
) -> Result<usize, GuestMemoryError>
pub fn read( &self, mem: &GuestMemory, target: &mut [u8], ) -> Result<usize, GuestMemoryError>
Read all readable payload into target.
Sourcepub fn read_at_offset(
&self,
offset: u64,
mem: &GuestMemory,
target: &mut [u8],
) -> Result<usize, GuestMemoryError>
pub fn read_at_offset( &self, offset: u64, mem: &GuestMemory, target: &mut [u8], ) -> Result<usize, GuestMemoryError>
Read readable payload into target, skipping the first offset
bytes of readable data.
Sourcepub fn consume(self) -> VirtioQueueCallbackWork
pub fn consume(self) -> VirtioQueueCallbackWork
Consume this peeked work, advancing the queue’s available index.
Returns a VirtioQueueCallbackWork that must be explicitly
completed via VirtioQueue::complete.
Auto Trait Implementations§
impl<'a> Freeze for PeekedWork<'a>
impl<'a> !RefUnwindSafe for PeekedWork<'a>
impl<'a> Send for PeekedWork<'a>
impl<'a> Sync for PeekedWork<'a>
impl<'a> Unpin for PeekedWork<'a>
impl<'a> UnsafeUnpin for PeekedWork<'a>
impl<'a> !UnwindSafe for PeekedWork<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more