rust/land2d/src/lib.rs
branchtransitional_engine
changeset 15901 f39f0f614dbf
parent 15893 5b3beb90e1a6
child 15904 33798b649d9c
equal deleted inserted replaced
15900:128ace913837 15901:f39f0f614dbf
     1 use std::{cmp, ops::Index};
     1 use std::{cmp, ops::Index, ops::IndexMut};
     2 
     2 
     3 use integral_geometry::{ArcPoints, EquidistantPoints, Line, Point, PotSize, Rect, Size, SizeMask};
     3 use integral_geometry::{ArcPoints, EquidistantPoints, Line, Point, PotSize, Rect, Size, SizeMask};
     4 
     4 
     5 pub struct Land2D<T> {
     5 pub struct Land2D<T> {
     6     pixels: vec2d::Vec2D<T>,
     6     pixels: vec2d::Vec2D<T>,
   286     fn index(&self, row: usize) -> &[T] {
   286     fn index(&self, row: usize) -> &[T] {
   287         &self.pixels[row]
   287         &self.pixels[row]
   288     }
   288     }
   289 }
   289 }
   290 
   290 
       
   291 impl<T> IndexMut<usize> for Land2D<T> {
       
   292     #[inline]
       
   293     fn index_mut(&mut self, row: usize) -> &mut [T] {
       
   294         &mut self.pixels[row]
       
   295     }
       
   296 }
       
   297 
   291 #[cfg(test)]
   298 #[cfg(test)]
   292 mod tests {
   299 mod tests {
   293     use super::*;
   300     use super::*;
   294 
   301 
   295     #[test]
   302     #[test]