pub struct DescriptorChain { /* private fields */ }Expand description
A fully validated, device-agnostic VirtIO descriptor chain.
The common queue layer hands complete, direction-tagged chains to device implementations (block, net, …) so that each device can interpret its own wire layout without leaking protocol specifics into the queue code.
Direction follows the VirtIO convention:
readabledescriptors are device-read (driver-written, notWRITE).writabledescriptors are device-write (driver-read,WRITEset).
Implementations§
Source§impl DescriptorChain
impl DescriptorChain
Sourcepub fn new(head: u16, descriptors: Vec<VirtQueueDesc>) -> Self
pub fn new(head: u16, descriptors: Vec<VirtQueueDesc>) -> Self
Construct a chain from its head index and ordered descriptors.
Sourcepub fn descriptors(&self) -> &[VirtQueueDesc]
pub fn descriptors(&self) -> &[VirtQueueDesc]
All descriptors in chain order.
Sourcepub fn readable(&self) -> impl Iterator<Item = &VirtQueueDesc>
pub fn readable(&self) -> impl Iterator<Item = &VirtQueueDesc>
Device-readable descriptors (driver-written, no VIRTQ_DESC_F_WRITE).
Sourcepub fn writable(&self) -> impl Iterator<Item = &VirtQueueDesc>
pub fn writable(&self) -> impl Iterator<Item = &VirtQueueDesc>
Device-writable descriptors (VIRTQ_DESC_F_WRITE set).
Sourcepub fn readable_len(&self) -> VirtioResult<usize>
pub fn readable_len(&self) -> VirtioResult<usize>
Total bytes across device-readable descriptors, checked against overflow.
Sourcepub fn writable_len(&self) -> VirtioResult<usize>
pub fn writable_len(&self) -> VirtioResult<usize>
Total bytes across device-writable descriptors, checked against overflow.
Trait Implementations§
Source§impl Clone for DescriptorChain
impl Clone for DescriptorChain
Source§fn clone(&self) -> DescriptorChain
fn clone(&self) -> DescriptorChain
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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