#[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 const unsafe fn new_unchecked(index: u32) -> Rank
pub const 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 const fn from_char(ch: char) -> Option<Rank>
pub const fn char(self) -> char
pub fn offset(self, delta: i32) -> Option<Rank>
pub const fn distance(self, other: Rank) -> u32
pub const fn flip_vertical(self) -> Rank
pub const fn flip_diagonal(self) -> File
pub const fn flip_anti_diagonal(self) -> File
pub const fn to_u32(self) -> u32
pub const fn to_usize(self) -> usize
Trait Implementations§
Source§impl Ord for Rank
impl Ord for Rank
Source§impl PartialOrd for Rank
impl PartialOrd for Rank
impl 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