MCPcopy Create free account
hub / github.com/PerroEngine/Perro / map_cells

Method map_cells

perro_source/core/perro_structs/src/structs/matrix/mod.rs:819–829  ·  view source on GitHub ↗
(self, mut f: impl FnMut(usize, usize, T) -> U)

Source from the content-addressed store, hash-verified

817
818 #[inline]
819 pub fn map_cells<U>(self, mut f: impl FnMut(usize, usize, T) -> U) -> Matrix<ROWS, COLS, U>
820 where
821 T: Copy,
822 {
823 Matrix(std::array::from_fn(|row| {
824 std::array::from_fn(|col| {
825 // SAFETY: array::from_fn indexes are in matrix bounds.
826 f(row, col, unsafe { *self.get_unchecked(row, col) })
827 })
828 }))
829 }
830
831 #[inline]
832 pub fn resize<const NEW_ROWS: usize, const NEW_COLS: usize>(

Calls 2

MatrixClass · 0.85
get_uncheckedMethod · 0.80