pub struct ChainBuilder(/* private fields */);Expand description
Builder for a Chain
Implementations§
Source§impl ChainBuilder
impl ChainBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new ChainBuilder
Sourcepub fn amend_next(self, next: u16) -> Self
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.
Sourcepub fn readable<T: Copy>(self, data: &[T], mem: &IdentityDriverMem) -> Self
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.
Sourcepub fn zeroed(
self,
access: DescAccess,
data_len: u32,
mem: &IdentityDriverMem,
) -> Self
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.
Sourcepub fn reference(
self,
access: DescAccess,
data_addr: u64,
data_len: u32,
) -> Self
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.