Struct virtio_device::queue::DescChain

source ·
pub struct DescChain<'a, 'b, N: DriverNotify> { /* private fields */ }
Expand description

Represents a chain of descriptors in the available ring.

The DescChain is a thin representation over a virtio descriptor chain. It can either be walked using its iterator, yielding the readable and writable portions, or it can be returned to the ring.

Although returning happens automatically when dropped, if data was written into the descriptors the chain needs to be explicitly returned with set_written to propagate the portion that was written.

Implementations§

source§

impl<'a, 'b, N: DriverNotify> DescChain<'a, 'b, N>

source

pub fn iter(&self) -> DescChainIter<'a, 'b, N>

Iterate over the descriptor chain

See DescChainIter.

source

pub fn return_written(self, written: u32)

Explicitly return a written to chain.

Returns the chain to the used ring, as if the chain was dropped, but also forwards how much of the chain was written to. No validation or manipulation is performed on written amount and it is faithfully passed through. In particular you can claim to have written more bytes than were made available for writing by the chain.

Trait Implementations§

source§

impl<'a, 'b, N: DriverNotify> Drop for DescChain<'a, 'b, N>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, 'b, N> Freeze for DescChain<'a, 'b, N>

§

impl<'a, 'b, N> !RefUnwindSafe for DescChain<'a, 'b, N>

§

impl<'a, 'b, N> !Send for DescChain<'a, 'b, N>

§

impl<'a, 'b, N> !Sync for DescChain<'a, 'b, N>

§

impl<'a, 'b, N> Unpin for DescChain<'a, 'b, N>

§

impl<'a, 'b, N> !UnwindSafe for DescChain<'a, 'b, N>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.