Enum bughouse::CastleRights [−][src]
pub enum CastleRights { NoRights, KingSide, QueenSide, Both, }
Expand description
What castle rights does a particular player have?
Variants
Implementations
Can I castle kingside?
Can I castle queenside?
What squares need to be empty to castle kingside?
What squares need to be empty to castle queenside?
Remove castle rights, and return a new CastleRights
.
Add some castle rights, and return a new CastleRights
.
Convert usize
to CastleRights
. Panic if invalid number.
Which rooks can we “guarantee” we haven’t moved yet?
Convert the castle rights to an FEN compatible string.
use chess::{CastleRights, Color}; assert_eq!(CastleRights::NoRights.to_string(Color::White), ""); assert_eq!(CastleRights::Both.to_string(Color::Black), "kq"); assert_eq!(CastleRights::KingSide.to_string(Color::White), "K"); assert_eq!(CastleRights::QueenSide.to_string(Color::Black), "q");
Given a square of a rook, which side is it on? Note: It is invalid to pass in a non-rook square. The code may panic.
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for CastleRights
impl Send for CastleRights
impl Sync for CastleRights
impl Unpin for CastleRights
impl UnwindSafe for CastleRights
Blanket Implementations
Mutably borrows from an owned value. Read more