Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "linkedbytes"
version = "0.1.10"
version = "0.1.11"
authors = ["Volo Team <volo@cloudwego.io>"]
edition = "2021"
description = "LinkedBytes is a linked list of Bytes and BytesMut."
Expand Down
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ impl LinkedBytes {
self.list.push_back(node);
}

pub fn io_slice(&mut self) -> Vec<IoSlice<'_>> {
let mut ioslice = Vec::with_capacity(self.list.len() + 1);
for node in self.list.iter() {
let bytes = node.as_ref();
if bytes.is_empty() {
continue;
}
ioslice.push(IoSlice::new(bytes));
}
if !self.bytes.is_empty() {
ioslice.push(IoSlice::new(self.bytes.as_ref()));
}
ioslice
}

// TODO: use write_all_vectored when stable
pub async fn write_all_vectored<W: AsyncWrite + Unpin>(
&mut self,
Expand Down
Loading