pub struct ChainBuilder<M: MemOps, P: BufferProvider + Clone> { /* private fields */ }Expand description
Builder for configuring a descriptor chain’s buffer layout.
If dropped without building, no resources are leaked (allocations are
deferred to build).
Implementations§
Source§impl<M: MemOps, P: BufferProvider + Clone> ChainBuilder<M, P>
impl<M: MemOps, P: BufferProvider + Clone> ChainBuilder<M, P>
Sourcepub fn readable(self, cap: usize) -> Self
pub fn readable(self, cap: usize) -> Self
Request a device-readable buffer of cap bytes.
The producer writes data into readable buffers before submission; the
consumer reads that data after polling the chain.
The actual allocation is deferred to build.
Sourcepub fn writable(self, cap: usize) -> Self
pub fn writable(self, cap: usize) -> Self
Request a device-writable buffer of cap bytes.
The writable buffer is filled by the consumer and returned via
VirtqProducer::poll as UsedChain.
Multiple writable buffers are completed as ordered Segments. The
consumer writes them sequentially, because the virtio used ring reports
one aggregate written length rather than per-descriptor lengths.
Sourcepub fn build(self) -> Result<SendChain<M, P>, VirtqError>
pub fn build(self) -> Result<SendChain<M, P>, VirtqError>
Allocate buffers and return a SendChain for writing.
§Errors
VirtqError::InvalidState- No buffers requestedVirtqError::Alloc- Pool exhausted