#[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
sourceimpl<T> ByRole<T>
impl<T> ByRole<T>
pub fn new_with<F>(init: F) -> ByRole<T> where
F: FnMut(Role) -> T,
pub 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> where
F: FnMut(&T) -> bool,
pub 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
sourceimpl<T> IntoIterator for ByRole<T>
impl<T> IntoIterator for ByRole<T>
sourceimpl<T: PartialEq> PartialEq<ByRole<T>> for ByRole<T>
impl<T: PartialEq> PartialEq<ByRole<T>> for ByRole<T>
impl<T: Copy> Copy for ByRole<T>
impl<T: Eq> Eq for ByRole<T>
impl<T> StructuralEq for ByRole<T>
impl<T> StructuralPartialEq for ByRole<T>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more