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

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Formats the value using the given formatter. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Creates a value from an iterator. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more