rust/land2d/src/lib.rs
branchtransitional_engine
changeset 15901 f39f0f614dbf
parent 15893 5b3beb90e1a6
child 15904 33798b649d9c
--- a/rust/land2d/src/lib.rs	Mon Jan 02 15:59:26 2023 +0100
+++ b/rust/land2d/src/lib.rs	Tue Jan 03 12:05:59 2023 +0100
@@ -1,4 +1,4 @@
-use std::{cmp, ops::Index};
+use std::{cmp, ops::Index, ops::IndexMut};
 
 use integral_geometry::{ArcPoints, EquidistantPoints, Line, Point, PotSize, Rect, Size, SizeMask};
 
@@ -288,6 +288,13 @@
     }
 }
 
+impl<T> IndexMut<usize> for Land2D<T> {
+    #[inline]
+    fn index_mut(&mut self, row: usize) -> &mut [T] {
+        &mut self.pixels[row]
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;