Enum cozy_chess::Rank
source · pub enum Rank {
First,
Second,
Third,
Fourth,
Fifth,
Sixth,
Seventh,
Eighth,
}
Expand description
A rank on a chessboard.
Variants§
First
The first rank.
Second
The second rank.
Third
The third rank.
Fourth
The fourth rank.
Fifth
The fifth rank.
Sixth
The sixth rank.
Seventh
The seventh rank.
Eighth
The eighth rank.
Implementations§
source§impl Rank
impl Rank
source§impl Rank
impl Rank
sourcepub const fn bitboard(self) -> BitBoard
pub const fn bitboard(self) -> BitBoard
Get a bitboard with all squares on this rank set.
§Examples
assert_eq!(Rank::Second.bitboard(), bitboard! {
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
X X X X X X X X
. . . . . . . .
});
sourcepub const fn relative_to(self, color: Color) -> Rank
pub const fn relative_to(self, color: Color) -> Rank
Get a rank relative to some color. This flips the rank if viewing from black’s perspective.
§Examples
assert_eq!(Rank::First.relative_to(Color::White), Rank::First);
assert_eq!(Rank::First.relative_to(Color::Black), Rank::Eighth);
Trait Implementations§
source§impl Ord for Rank
impl Ord for Rank
source§impl PartialEq for Rank
impl PartialEq for Rank
source§impl PartialOrd for Rank
impl PartialOrd for Rank
1.0.0 · source§fn 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 Rank
impl Eq for Rank
impl StructuralPartialEq for Rank
Auto Trait Implementations§
impl Freeze for Rank
impl RefUnwindSafe for Rank
impl Send for Rank
impl Sync for Rank
impl Unpin for Rank
impl UnwindSafe for Rank
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more