pub struct Segments(/* private fields */);Expand description
Ordered byte segments that make up one virtqueue payload.
This is the high-level counterpart to the descriptor-oriented
BufferChain.
Implementations§
Source§impl Segments
impl Segments
Sourcepub fn new(segments: impl IntoIterator<Item = Bytes>) -> Self
pub fn new(segments: impl IntoIterator<Item = Bytes>) -> Self
Build a segmented payload from ordered byte segments.
Sourcepub fn segment_count(&self) -> usize
pub fn segment_count(&self) -> usize
Number of byte segments.
Sourcepub fn as_buf(&self) -> SegmentsBuf<'_>
pub fn as_buf(&self) -> SegmentsBuf<'_>
Borrow this payload as a Buf cursor.
Sourcepub fn to_bytes(&self) -> Bytes
pub fn to_bytes(&self) -> Bytes
Return this payload as contiguous bytes.
This is O(1) for zero or one segment, and allocates/copies for multiple segments.
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Consume this payload and return contiguous bytes.
This is O(1) for zero or one segment, and allocates/copies for multiple segments.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Segments
impl RefUnwindSafe for Segments
impl Send for Segments
impl Sync for Segments
impl Unpin for Segments
impl UnsafeUnpin for Segments
impl UnwindSafe for Segments
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more