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