From b3a1e476b2e9c8eaf194d2d24e6c23fa58709c77 Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Wed, 5 Nov 2025 23:47:00 +0100 Subject: [PATCH] misc --- src/board.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/board.rs b/src/board.rs index 99732e6..eb545f3 100644 --- a/src/board.rs +++ b/src/board.rs @@ -13,13 +13,6 @@ macro_rules! container { Self(values) } #[inline] - pub fn with(f: F) -> Self - where - F: FnMut($a) -> T, - { - Self($a::all().map(f)) - } - #[inline] pub const fn get(&self, k: $a) -> &T { &self.0[k as usize] } @@ -27,6 +20,13 @@ macro_rules! container { pub const fn get_mut(&mut self, k: $a) -> &mut T { &mut self.0[k as usize] } + #[inline] + pub fn with(f: F) -> Self + where + F: FnMut($a) -> T, + { + Self($a::all().map(f)) + } } }; } @@ -561,14 +561,6 @@ impl Role { pub struct ByRole(pub(crate) [T; 6]); #[allow(unused)] impl ByRole { - #[inline] - pub fn with(f: F) -> Self - where - F: FnMut(Role) -> T, - { - Self(Role::all().map(f)) - } - #[inline] pub const fn new(values: [T; 6]) -> Self { Self(values) @@ -587,6 +579,14 @@ impl ByRole { unsafe { std::hint::assert_unchecked(i < 6) }; &mut self.0[i] } + + #[inline] + pub fn with(f: F) -> Self + where + F: FnMut(Role) -> T, + { + Self(Role::all().map(f)) + } } impl ByRole