Enum chess::CastleRights
source · pub enum CastleRights {
NoRights,
KingSide,
QueenSide,
Both,
}
Expand description
What castle rights does a particular player have?
Variants
NoRights
KingSide
QueenSide
Both
Implementations
sourceimpl CastleRights
impl CastleRights
sourcepub fn has_kingside(&self) -> bool
pub fn has_kingside(&self) -> bool
Can I castle kingside?
sourcepub fn has_queenside(&self) -> bool
pub fn has_queenside(&self) -> bool
Can I castle queenside?
pub fn square_to_castle_rights(color: Color, sq: Square) -> CastleRights
sourcepub fn kingside_squares(&self, color: Color) -> BitBoardⓘNotable traits for BitBoardimpl Iterator for BitBoard type Item = Square;
pub fn kingside_squares(&self, color: Color) -> BitBoardⓘNotable traits for BitBoardimpl Iterator for BitBoard type Item = Square;
What squares need to be empty to castle kingside?
sourcepub fn queenside_squares(&self, color: Color) -> BitBoardⓘNotable traits for BitBoardimpl Iterator for BitBoard type Item = Square;
pub fn queenside_squares(&self, color: Color) -> BitBoardⓘNotable traits for BitBoardimpl Iterator for BitBoard type Item = Square;
What squares need to be empty to castle queenside?
sourcepub fn remove(&self, remove: CastleRights) -> CastleRights
pub fn remove(&self, remove: CastleRights) -> CastleRights
Remove castle rights, and return a new CastleRights
.
sourcepub fn add(&self, add: CastleRights) -> CastleRights
pub fn add(&self, add: CastleRights) -> CastleRights
Add some castle rights, and return a new CastleRights
.
sourcepub fn from_index(i: usize) -> CastleRights
pub fn from_index(i: usize) -> CastleRights
Convert usize
to CastleRights
. Panic if invalid number.
sourcepub fn unmoved_rooks(&self, color: Color) -> BitBoardⓘNotable traits for BitBoardimpl Iterator for BitBoard type Item = Square;
pub fn unmoved_rooks(&self, color: Color) -> BitBoardⓘNotable traits for BitBoardimpl Iterator for BitBoard type Item = Square;
Which rooks can we “guarantee” we haven’t moved yet?
sourcepub fn rook_square_to_castle_rights(square: Square) -> CastleRights
pub fn rook_square_to_castle_rights(square: Square) -> CastleRights
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
sourceimpl Clone for CastleRights
impl Clone for CastleRights
sourcefn clone(&self) -> CastleRights
fn clone(&self) -> CastleRights
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for CastleRights
impl Debug for CastleRights
sourceimpl PartialEq<CastleRights> for CastleRights
impl PartialEq<CastleRights> for CastleRights
sourcefn eq(&self, other: &CastleRights) -> bool
fn eq(&self, other: &CastleRights) -> bool
sourceimpl PartialOrd<CastleRights> for CastleRights
impl PartialOrd<CastleRights> for CastleRights
sourcefn partial_cmp(&self, other: &CastleRights) -> Option<Ordering>
fn partial_cmp(&self, other: &CastleRights) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for CastleRights
impl StructuralPartialEq for CastleRights
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more