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

Method zip_each_mut

perro_source/core/perro_structs/src/structs/matrix/mod.rs:465–482  ·  view source on GitHub ↗
(
        &mut self,
        rhs: &Matrix<ROWS, COLS, U>,
        mut f: impl FnMut(usize, usize, &mut T, &U),
    )

Source from the content-addressed store, hash-verified

463
464 #[inline]
465 pub fn zip_each_mut<U>(
466 &mut self,
467 rhs: &Matrix<ROWS, COLS, U>,
468 mut f: impl FnMut(usize, usize, &mut T, &U),
469 ) -> &mut Self {
470 for row in 0..ROWS {
471 for col in 0..COLS {
472 // SAFETY: row/col come from matrix bounds for both same-shape matrices.
473 f(
474 row,
475 col,
476 unsafe { self.get_unchecked_mut(row, col) },
477 unsafe { rhs.get_unchecked(row, col) },
478 );
479 }
480 }
481 self
482 }
483
484 #[inline]
485 pub fn for_neighbors_4(

Calls 2

get_unchecked_mutMethod · 0.80
get_uncheckedMethod · 0.80