pub struct ByColor<T> {
pub white: T,
pub black: T,
}
Expand description
Container with values for each Color
.
Fields
white: T
black: T
Implementations
pub fn iter(&self) -> ByColorIter<&T>ⓘNotable traits for ByColorIter<T>impl<T> Iterator for ByColorIter<T> type Item = T;
impl<T> Iterator for ByColorIter<T> type Item = T;
pub fn iter_mut(&mut self) -> ByColorIter<&mut T>ⓘNotable traits for ByColorIter<T>impl<T> Iterator for ByColorIter<T> type Item = T;
impl<T> Iterator for ByColorIter<T> type Item = T;
Parse material from notation like KPPvKR
.
Errors
Returns ParseMaterialError
if there are any unrecognized
characters, not exactly one v
to separate white pieces from black
pieces, or more than 64 pieces.
Examples
use shakmaty::Material;
let material = Material::from_ascii(b"KPPvKR")?;
assert_eq!(material.white.kings, 1);
assert_eq!(material.white.pawns, 2);
assert_eq!(material.black.kings, 1);
assert_eq!(material.black.rooks, 1);
Parse material from notation like KPPkr
, where white pieces are
uppercase characters and black pieces are lowercase characters.
Errors
Returns ParseMaterialError
if there are any unrecognized
characters, or more than 64 pieces.
Examples
use shakmaty::Material;
let material = Material::from_ascii_fen(b"KPPkr")?;
assert_eq!(material.white.kings, 1);
assert_eq!(material.white.pawns, 2);
assert_eq!(material.black.kings, 1);
assert_eq!(material.black.rooks, 1);
Trait Implementations
Performs the +=
operation. Read more
Performs the +=
operation. Read more
type Item = T
type Item = T
The type of the elements being iterated over.
type IntoIter = ByColorIter<T>
type IntoIter = ByColorIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> ByColorIter<T>ⓘNotable traits for ByColorIter<T>impl<T> Iterator for ByColorIter<T> type Item = T;
fn into_iter(self) -> ByColorIter<T>ⓘNotable traits for ByColorIter<T>impl<T> Iterator for ByColorIter<T> type Item = T;
impl<T> Iterator for ByColorIter<T> type Item = T;
Creates an iterator from a value. Read more
Performs the -=
operation. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for ByColor<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for ByColor<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more