equal
deleted
inserted
replaced
49 pub fn height(&self) -> usize { |
49 pub fn height(&self) -> usize { |
50 self.height |
50 self.height |
51 } |
51 } |
52 |
52 |
53 #[inline] |
53 #[inline] |
|
54 pub fn get(&self, row: usize, column: usize) -> Option<&<usize as SliceIndex<[T]>>::Output> { |
|
55 self.data.get(row * self.width + column) |
|
56 } |
|
57 |
|
58 #[inline] |
54 pub fn get_mut(&mut self, row: usize, column: usize) -> Option<&mut <usize as SliceIndex<[T]>>::Output> { |
59 pub fn get_mut(&mut self, row: usize, column: usize) -> Option<&mut <usize as SliceIndex<[T]>>::Output> { |
55 self.data.get_mut(row * self.width + column) |
60 self.data.get_mut(row * self.width + column) |
56 } |
61 } |
57 |
62 |
58 #[inline] |
63 #[inline] |
59 pub fn get(&self, row: usize, column: usize) -> Option<&<usize as SliceIndex<[T]>>::Output> { |
64 pub unsafe fn get_unchecked(&self, row: usize, column: usize) -> &<usize as SliceIndex<[T]>>::Output { |
60 self.data.get(row * self.width + column) |
65 self.data.get_unchecked(row * self.width + column) |
|
66 } |
|
67 |
|
68 #[inline] |
|
69 pub unsafe fn get_unchecked_mut(&mut self, row: usize, column: usize) -> &mut <usize as SliceIndex<[T]>>::Output { |
|
70 self.data.get_unchecked_mut(row * self.width + column) |
61 } |
71 } |
62 } |
72 } |
63 |
73 |
64 #[cfg(test)] |
74 #[cfg(test)] |
65 mod tests { |
75 mod tests { |