rust/vec2d/src/lib.rs
changeset 14030 2ebd505e62c1
parent 13930 5c9d963492bf
child 14032 2869c2ccb1b8
--- a/rust/vec2d/src/lib.rs	Mon Oct 29 23:40:17 2018 +0300
+++ b/rust/vec2d/src/lib.rs	Tue Oct 30 02:14:00 2018 +0300
@@ -69,6 +69,11 @@
     pub unsafe fn get_unchecked_mut(&mut self, row: usize, column: usize) -> &mut <usize as SliceIndex<[T]>>::Output {
         self.data.get_unchecked_mut(row * self.width + column)
     }
+
+    #[inline]
+    pub fn rows(&self) -> impl Iterator<Item = &[T]> {
+        self.data.chunks(self.width)
+    }
 }
 
 #[cfg(test)]