Type Definition shakmaty::Material [−][src]
pub type Material = ByColor<MaterialSide>;
Expand description
The material configuration of both sides.
Implementations
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
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
type Err = ParseMaterialError
type Err = ParseMaterialError
The associated error which can be returned from parsing.
Performs the -=
operation. Read more
Performs the -=
operation. Read more