From c675683da924026ea486125d71ecbb858adb131a Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Wed, 27 Aug 2025 09:24:48 +0100 Subject: [PATCH] protocol: IntoIterator for BoundedVec Implement `IntoIterator` for the `BoundedVec`. This allows the use of `into_iter` for returning the owned data, rather than references via the `Deref` implementation. --- crates/radicle-protocol/src/bounded.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/radicle-protocol/src/bounded.rs b/crates/radicle-protocol/src/bounded.rs index 06e51aa0..ef67bd93 100644 --- a/crates/radicle-protocol/src/bounded.rs +++ b/crates/radicle-protocol/src/bounded.rs @@ -180,6 +180,15 @@ impl BoundedVec { } } +impl IntoIterator for BoundedVec { + type Item = T; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.v.into_iter() + } +} + impl ops::Deref for BoundedVec { type Target = [T];