Struct shogi::hand::Hand[][src]

pub struct Hand { /* fields omitted */ }
Expand description

Manages the number of each pieces in each player’s hand.

Examples

use shogi::{Color, Hand, Piece, PieceType};

let mut hand: Hand = Default::default();
let black_pawn = Piece{piece_type: PieceType::Pawn, color: Color::Black};
let white_pawn = Piece{piece_type: PieceType::Pawn, color: Color::White};

hand.set(black_pawn, 2);
hand.increment(black_pawn);
assert_eq!(3, hand.get(black_pawn));
assert_eq!(0, hand.get(white_pawn));

Implementations

Returns a number of the given piece.

Sets a number of the given piece.

Increments a number of the given piece.

Decrements a number of the given piece.

Clears all pieces.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. 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 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.