pub struct DescriptorChain { /* private fields */ }Expand description
Iterator over the descriptors in a single chain (head + linked descriptors
via NEXT).
Implementations§
Source§impl DescriptorChain
impl DescriptorChain
Sourcepub fn head_index(&self) -> u16
pub fn head_index(&self) -> u16
Index of the head descriptor — pass to Queue::push_used when
completing the chain.
Sourcepub fn next_descriptor<M: GuestMemory + ?Sized>(
&mut self,
mem: &M,
) -> Result<Option<Descriptor>, QueueError>
pub fn next_descriptor<M: GuestMemory + ?Sized>( &mut self, mem: &M, ) -> Result<Option<Descriptor>, QueueError>
Read the next descriptor in the chain, if any.
Returns Ok(None) when the chain is fully traversed.
§Errors
QueueError::DescriptorOutOfRangeifnextexceedsqueue_size.QueueError::ChainTooLongif the chain length exceedsqueue_size(cycle protection).QueueError::Memoryfor any descriptor table read failure.
Sourcepub fn collect<M: GuestMemory + ?Sized>(
self,
mem: &M,
) -> Result<Vec<Descriptor>, QueueError>
pub fn collect<M: GuestMemory + ?Sized>( self, mem: &M, ) -> Result<Vec<Descriptor>, QueueError>
Drain the chain into a Vec<Descriptor>. Convenience for short
chains where the caller wants to pre-collect.
§Errors
Same as Self::next_descriptor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DescriptorChain
impl RefUnwindSafe for DescriptorChain
impl Send for DescriptorChain
impl Sync for DescriptorChain
impl Unpin for DescriptorChain
impl UnsafeUnpin for DescriptorChain
impl UnwindSafe for DescriptorChain
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