rust/integral-geometry/src/lib.rs
changeset 14155 8f82d87d223f
parent 14152 5acfdf49742d
child 14175 76a52e8149e3
equal deleted inserted replaced
14154:8354b390f1a2 14155:8f82d87d223f
   503     pub fn iter<'a>(&'a self) -> impl Iterator<Item = &Point> + 'a {
   503     pub fn iter<'a>(&'a self) -> impl Iterator<Item = &Point> + 'a {
   504         (&self.vertices[..self.edges_count()]).iter()
   504         (&self.vertices[..self.edges_count()]).iter()
   505     }
   505     }
   506 
   506 
   507     pub fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = &mut Point> + 'a {
   507     pub fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = &mut Point> + 'a {
       
   508         let edges_count = self.edges_count();
   508         let start = self.vertices.as_mut_ptr();
   509         let start = self.vertices.as_mut_ptr();
   509         let end = unsafe { start.add(self.vertices.len()) };
   510         let end = unsafe { start.add(edges_count) };
   510         PolygonPointsIteratorMut {
   511         PolygonPointsIteratorMut {
   511             source: self,
   512             source: self,
   512             start,
   513             start,
   513             end,
   514             end,
   514         }
   515         }