diff --git a/Cargo.toml b/Cargo.toml index 0d55156..194594a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "linkedbytes" -version = "0.1.8" +version = "0.1.9" authors = ["Volo Team "] edition = "2021" description = "LinkedBytes is a linked list of Bytes and BytesMut." diff --git a/src/lib.rs b/src/lib.rs index e5a8101..194e71a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -298,6 +298,16 @@ impl LinkedBytes { pub fn iter_list(&self) -> impl Iterator { self.list.iter() } + + /// This converts the list to an iterator. + /// This is an unstable API that may change in the future, don't rely on this. + #[doc(hidden)] + #[inline] + pub fn into_iter_list(mut self) -> impl Iterator { + let node = Node::BytesMut(self.bytes); + self.list.push_back(node); + self.list.into_iter() + } } impl Default for LinkedBytes {