# HG changeset patch # User Tuomo Valkonen # Date 1785873238 18000 # Node ID 016122e0384ba6fefabd8516253f68761217efcc # Parent ad16acf4772611745544c4d724adbfa3cb1e1f2e All FnMut in some maps diff -r ad16acf47726 -r 016122e0384b src/maputil.rs --- a/src/maputil.rs Mon Aug 03 19:26:21 2026 -0500 +++ b/src/maputil.rs Tue Aug 04 14:53:58 2026 -0500 @@ -80,7 +80,7 @@ >( $var0 : $ctype0, $($var : $ctype,)* - f : impl Fn($etype0, $($etype),*) -> Res + mut f : impl FnMut($etype0, $($etype),*) -> Res ) -> [Res; N] { let zipit = izip!($var0.fl_iter(), $($var.fl_iter()),*); let map = zipit.map(|tuple_or_singleton!($var0, $($var),*)| f($var0, $($var),*)); @@ -99,7 +99,7 @@ >( $var0 : $ctype0, $($var : $ctype,)* - f : impl Fn(usize, $etype0, $($etype),*) -> Res + mut f : impl FnMut(usize, $etype0, $($etype),*) -> Res ) -> [Res; N] { let zipit = (0..N).zip(izip!($var0.fl_iter(), $($var.fl_iter()),*)); let map = zipit.map(|(i, tuple_or_singleton!($var0, $($var),*))| f(i, $var0, $($var),*)); @@ -263,11 +263,7 @@ F: Fn(usize, &'a A) -> B; #[inline] fn indexmap B>(self, f: F) -> Self::Output { - IndexMap { - iter: self, - j: 0, - f, - } + IndexMap { iter: self, j: 0, f } } } @@ -289,11 +285,7 @@ F: Fn(usize, A) -> B; #[inline] fn indexmap B>(self, f: F) -> Self::Output { - IndexMap { - iter: self, - j: 0, - f, - } + IndexMap { iter: self, j: 0, f } } } @@ -382,10 +374,7 @@ } let mut array = [const { MaybeUninit::uninit() }; N]; - let mut guard = Guard { - array_mut: &mut array, - initialized: 0, - }; + let mut guard = Guard { array_mut: &mut array, initialized: 0 }; while let Some(item) = iter.next() { // SAFETY: `guard.initialized` starts at 0, is increased by one in the diff -r ad16acf47726 -r 016122e0384b src/sets/cube.rs --- a/src/sets/cube.rs Mon Aug 03 19:26:21 2026 -0500 +++ b/src/sets/cube.rs Tue Aug 04 14:53:58 2026 -0500 @@ -97,14 +97,14 @@ /// Maps `f` over the triples $\\{(i, a\_i, b\_i)\\}\_{i=1}^N$ /// of the cube $∏_{i=1}^N [a_i, b_i)$. #[inline] - pub fn map_indexed(&self, f: impl Fn(usize, U, U) -> T) -> [T; N] { + pub fn map_indexed(&self, mut f: impl FnMut(usize, U, U) -> T) -> [T; N] { map1_indexed(self, |i, &[a, b]| f(i, a, b)) } /// Maps `f` over the tuples $\\{(a\_i, b\_i)\\}\_{i=1}^N$ /// of the cube $∏_{i=1}^N [a_i, b_i)$. #[inline] - pub fn map(&self, f: impl Fn(U, U) -> T) -> [T; N] { + pub fn map(&self, mut f: impl FnMut(U, U) -> T) -> [T; N] { map1(self, |&[a, b]| f(a, b)) } @@ -145,10 +145,7 @@ /// $∏_{i=1}^N [a_i, b_i)$. #[inline] pub fn iter_corners(&self) -> CubeCornersIter<'_, U, N> { - CubeCornersIter { - index: 0, - cube: self, - } + CubeCornersIter { index: 0, cube: self } } /// Returns the width-`N`-tuple $(b_1-a_1, … ,b_N-a_N)$ of the cube $∏_{i=1}^N [a_i, b_i)$.