rust/vec2d/src/lib.rs
changeset 14170 a4c1a2d0ac24
parent 14160 c24a76f131d6
child 14207 bb2f301d4fe0
equal deleted inserted replaced
14169:e2c51c8e0b2e 14170:a4c1a2d0ac24
    84     pub unsafe fn get_unchecked_mut(&mut self, row: usize, column: usize) -> &mut <usize as SliceIndex<[T]>>::Output {
    84     pub unsafe fn get_unchecked_mut(&mut self, row: usize, column: usize) -> &mut <usize as SliceIndex<[T]>>::Output {
    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 Iterator<Item = &[T]> {
    89     pub fn rows(&self) -> impl DoubleEndedIterator<Item = &[T]> {
    90         self.data.chunks(self.width())
    90         self.data.chunks(self.width())
    91     }
    91     }
    92 
    92 
    93     #[inline]
    93     #[inline]
    94     pub fn rows_mut(&mut self) -> impl Iterator<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_mut(width)
    97     }
    97     }
    98 }
    98 }
    99 
    99