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

pub struct Hand { /* fields omitted */ }

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));

Methods

impl Hand
[src]

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

impl Debug for Hand
[src]

Formats the value using the given formatter.

impl Default for Hand
[src]

Returns the "default value" for a type. Read more