From dfa83e486c3fd754a2047accbca63e1115177295 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sat, 16 Nov 2019 20:21:47 +0200 Subject: [PATCH] melib: add into_iter() for &StackVec --- melib/src/structs.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/melib/src/structs.rs b/melib/src/structs.rs index 356c9beb..569f7dab 100644 --- a/melib/src/structs.rs +++ b/melib/src/structs.rs @@ -186,6 +186,16 @@ impl IntoIterator for StackVec { StackVecIterOwned(self) } } + +impl<'a, T: Default + Copy + std::fmt::Debug> IntoIterator for &'a StackVec { + type Item = &'a T; + type IntoIter = StackVecIter<'a, T>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + impl Iterator for StackVecIterOwned { type Item = T; fn next(&mut self) -> Option {