#[repr(u8)]pub enum Rank {
First = 0,
Second = 1,
Third = 2,
Fourth = 3,
Fifth = 4,
Sixth = 5,
Seventh = 6,
Eighth = 7,
}
Expand description
A rank of the chessboard.
Variants§
Implementations§
source§impl Rank
impl Rank
sourcepub unsafe fn new_unchecked(index: u32) -> Rank
pub unsafe fn new_unchecked(index: u32) -> Rank
Gets a Rank
from an integer index.
§Safety
It is the callers responsibility to ensure the index is in the range
0..=7
.
pub fn from_char(ch: char) -> Option<Rank>
pub fn char(self) -> char
pub fn offset(self, delta: i32) -> Option<Rank>
pub fn distance(self, other: Rank) -> u32
pub fn flip_vertical(self) -> Rank
pub fn flip_diagonal(self) -> File
pub fn flip_anti_diagonal(self) -> File
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 IsEnabled for Rank
Available on crate feature
nohash-hasher
only.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