From 70ec7791b46d0e5e4ccef1f134becdcc9490bca0 Mon Sep 17 00:00:00 2001 From: "wangjie.wjdew" Date: Wed, 21 May 2025 17:32:49 +0800 Subject: [PATCH 1/3] feat: support into iter for linkedbytes --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index e5a8101..b7260ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -298,6 +298,14 @@ 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(self) -> impl Iterator { + self.list.into_iter() + } } impl Default for LinkedBytes { From e1b6778d737653c82950878143fd503d8a2168dd Mon Sep 17 00:00:00 2001 From: "wangjie.wjdew" Date: Wed, 21 May 2025 17:33:05 +0800 Subject: [PATCH 2/3] feat: support into iter for linkedbytes --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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." From 7edd902c50f256ce790bcd87076f1a99e6dc51d9 Mon Sep 17 00:00:00 2001 From: "wangjie.wjdew" Date: Wed, 25 Jun 2025 15:18:04 +0800 Subject: [PATCH 3/3] fix: append the current bytes into the list --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index b7260ff..194e71a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -303,7 +303,9 @@ impl LinkedBytes { /// This is an unstable API that may change in the future, don't rely on this. #[doc(hidden)] #[inline] - pub fn into_iter_list(self) -> impl Iterator { + pub fn into_iter_list(mut self) -> impl Iterator { + let node = Node::BytesMut(self.bytes); + self.list.push_back(node); self.list.into_iter() } }