#[repr(C)]pub struct ByRole<T> {
pub pawn: T,
pub knight: T,
pub bishop: T,
pub rook: T,
pub queen: T,
pub king: T,
}
Expand description
Container with values for each Role
.
Fields§
§pawn: T
§knight: T
§bishop: T
§rook: T
§queen: T
§king: T
Implementations§
source§impl<T> ByRole<T>
impl<T> ByRole<T>
pub fn new_with<F>(init: F) -> ByRole<T>
pub const fn get(&self, role: Role) -> &T
pub fn get_mut(&mut self, role: Role) -> &mut T
pub fn for_each<F>(self, f: F)where
F: FnMut(T),
pub fn map<U, F>(self, f: F) -> ByRole<U>where
F: FnMut(T) -> U,
pub fn find<F>(&self, predicate: F) -> Option<Role>
pub const fn as_ref(&self) -> ByRole<&T>
pub fn as_mut(&mut self) -> ByRole<&mut T>
pub fn zip<U>(self, other: ByRole<U>) -> ByRole<(T, U)>
pub fn zip_role(self) -> ByRole<(Role, T)>
pub fn iter(&self) -> IntoIter<&T, 6>
pub fn iter_mut(&mut self) -> IntoIter<&mut T, 6>
Trait Implementations§
source§impl<T> IntoIterator for ByRole<T>
impl<T> IntoIterator for ByRole<T>
source§impl<T: PartialEq> PartialEq for ByRole<T>
impl<T: PartialEq> PartialEq for ByRole<T>
impl<T: Copy> Copy for ByRole<T>
impl<T: Eq> Eq for ByRole<T>
impl<T> StructuralPartialEq for ByRole<T>
Auto Trait Implementations§
impl<T> Freeze for ByRole<T>where
T: Freeze,
impl<T> RefUnwindSafe for ByRole<T>where
T: RefUnwindSafe,
impl<T> Send for ByRole<T>where
T: Send,
impl<T> Sync for ByRole<T>where
T: Sync,
impl<T> Unpin for ByRole<T>where
T: Unpin,
impl<T> UnwindSafe for ByRole<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more