Skip to content

Commit be01bcd

Browse files
committed
impl IntoIterator for &Aligned
1 parent b67cabc commit be01bcd

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,32 @@ where
483483
}
484484
}
485485

486+
impl<'a, A, T> IntoIterator for &'a Aligned<A, T>
487+
where
488+
A: Alignment,
489+
&'a T: IntoIterator,
490+
{
491+
type IntoIter = <&'a T as IntoIterator>::IntoIter;
492+
type Item = <&'a T as IntoIterator>::Item;
493+
494+
fn into_iter(self) -> Self::IntoIter {
495+
(&self.value).into_iter()
496+
}
497+
}
498+
499+
impl<'a, A, T> IntoIterator for &'a mut Aligned<A, T>
500+
where
501+
A: Alignment,
502+
&'a mut T: IntoIterator,
503+
{
504+
type IntoIter = <&'a mut T as IntoIterator>::IntoIter;
505+
type Item = <&'a mut T as IntoIterator>::Item;
506+
507+
fn into_iter(self) -> Self::IntoIter {
508+
(&mut self.value).into_iter()
509+
}
510+
}
511+
486512
#[test]
487513
fn sanity() {
488514
use core::mem;

0 commit comments

Comments
 (0)