virtio_device::fake_queue

Struct ChainBuilder

Source
pub struct ChainBuilder(/* private fields */);
Expand description

Builder for a Chain

Implementations§

Source§

impl ChainBuilder

Source

pub fn new() -> Self

Construct a new ChainBuilder

Source

pub fn amend_next(self, next: u16) -> Self

Amend the last descriptor added with a specific next value.

By default the next field in the published ring::Desc will be set automatically by the FakeQueue when publishing the chain, since the FakeQueue is the one allocating the actual descriptor ring slots.

For testing this can be used to override the next field that FakeQueue::publish will generate and is intended for creating broken descriptor chains. It is not intended that this can be used and result in a properly functioning chain and queue.

§Panics

Will panic if no descriptor has yet been added to the chain.

Source

pub fn readable<T: Copy>(self, data: &[T], mem: &IdentityDriverMem) -> Self

Append new readable descriptor with a copy of data

§Panics

Will panic if there is not enough memory to allocate a buffer to hold data.

Source

pub fn zeroed( self, access: DescAccess, data_len: u32, mem: &IdentityDriverMem, ) -> Self

Append an empty descriptor of the specified type and length

§Panics

Will panic if there is not enough memory to allocate a buffer of len data_len.

Source

pub fn reference( self, access: DescAccess, data_addr: u64, data_len: u32, ) -> Self

Append a descriptor with raw data.

This does not perform any allocations and will pass through the exact data_addr and data_len provided.

Source

pub fn readable_zeroed(self, len: u32, mem: &IdentityDriverMem) -> Self

Source

pub fn readable_reference(self, addr: u64, len: u32) -> Self

Source

pub fn writable(self, len: u32, mem: &IdentityDriverMem) -> Self

Source

pub fn writable_reference(self, addr: u64, len: u32) -> Self

Source

pub fn build(self) -> Chain

Consume the builder and produce a Chain.

Auto Trait Implementations§

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>,

Source§

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>,

Source§

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.