pub struct ByColor<T> {
    pub white: T,
    pub black: T,
}
Expand description

Container with values for each Color.

Fields

white: Tblack: T

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.