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

§

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.