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