v2/item: Implement IntoIterator for Block
//! Shared `sallyport` item definitions.
-use crate::iter::Iterator;
+use crate::iter::{IntoIterator, Iterator};
use crate::Error;
use core::convert::{TryFrom, TryInto};
@@ -144,6 +144,15 @@ impl<'a> Iterator for Block<'a> {
}
}
+impl<'a> IntoIterator for Block<'a> {
+ type Item = <Self as Iterator>::Item;
+ type IntoIter = Self;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;
