rust/vec2d/src/lib.rs
changeset 14371 31717e1436cd
parent 14228 bb2f301d4fe0
child 14723 29dbe9ce8b7d
equal deleted inserted replaced
14370:d35e0fdb70f6 14371:31717e1436cd
    85         self.data.get_unchecked_mut(row * self.size.width + column)
    85         self.data.get_unchecked_mut(row * self.size.width + column)
    86     }
    86     }
    87 
    87 
    88     #[inline]
    88     #[inline]
    89     pub fn rows(&self) -> impl DoubleEndedIterator<Item = &[T]> {
    89     pub fn rows(&self) -> impl DoubleEndedIterator<Item = &[T]> {
    90         self.data.chunks(self.width())
    90         self.data.chunks_exact(self.width())
    91     }
    91     }
    92 
    92 
    93     #[inline]
    93     #[inline]
    94     pub fn rows_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut [T]> {
    94     pub fn rows_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut [T]> {
    95         let width = self.width();
    95         let width = self.width();
    96         self.data.chunks_mut(width)
    96         self.data.chunks_exact_mut(width)
    97     }
    97     }
    98 }
    98 }
    99 
    99 
   100 impl<T: Copy> AsRef<[T]> for Vec2D<T> {
   100 impl<T: Copy> AsRef<[T]> for Vec2D<T> {
   101     fn as_ref(&self) -> &[T] {
   101     fn as_ref(&self) -> &[T] {