pub trait FlagCheck {
// Required method
fn get_flags(&self) -> u8;
// Provided method
fn check_flag(&self, flag: u8) -> bool { ... }
}
Expand description
Implements function to easily check chess turn flags
Required Methods§
Provided Methods§
Sourcefn check_flag(&self, flag: u8) -> bool
fn check_flag(&self, flag: u8) -> bool
Returns true if flag is present
§Example
use chess_notation_parser::{Turn, Move, Square, Piece, Flag, FlagCheck};
let r#move = Move {
who: Piece::King,
dst: Square::D5,
flags: Flag::CAPTURE,
src: None,
promotion: None
};
assert!(r#move.check_flag(Flag::CAPTURE));
assert!(!r#move.check_flag(Flag::CHECK));