[−][src]Struct pleco::core::sq::SQ
Represents a singular square of a chessboard.
Methods
impl SQ
[src]
pub const NONE: SQ
[src]
A square that isn't on the board. Basically equivilant to Option<SQ>
where the value is
None
.
pub fn to_string(self) -> String
[src]
Returns the UCI String representation of a SQ
.
pub const fn is_okay(self) -> bool
[src]
Returns if a SQ
is within the legal bounds of a square,
which is inclusively between 0 - 63.
Examples
use pleco::SQ; let sq_ok = SQ(5); let no_sq = SQ(64); assert!(sq_ok.is_okay()); assert!(!no_sq.is_okay());
pub fn distance(self, sq_other: SQ) -> u8
[src]
Returns distance between this square and another square. Distance is not in algebraic difference, but in squares away.
Examples
use pleco::SQ; let a1 = SQ::A1; let b2 = SQ::B2; let b3 = SQ::B3; assert_eq!(a1.distance(a1), 0); assert_eq!(a1.distance(b2), 1); assert_eq!(a1.distance(b3), 2);
ⓘImportant traits for BitBoardpub fn to_bb(self) -> BitBoard
[src]
Converts a SQ
to it's BitBoard
equivalent. The resulting BitBoard
will
have exactly 1 bit set at the index where the square is location on the
chessboard.
pub fn rank(self) -> Rank
[src]
Returns the Rank
that a SQ
lies on.
Examples
use pleco::{SQ,Rank}; let sq_f2 = SQ::F2; assert_eq!(sq_f2.rank(), Rank::R2);
ⓘImportant traits for BitBoardpub fn rank_bb(self) -> BitBoard
[src]
Returns the BitBoard
representation of a Rank
that a SQ
lies on.
pub const fn rank_idx_of_sq(self) -> u8
[src]
Returns the rank index (number) of a SQ
.
pub fn file(self) -> File
[src]
Returns the File
that a SQ
lies on.
Examples
use pleco::{SQ,File}; let sq_f2 = SQ::F2; assert_eq!(sq_f2.file(), File::F);
ⓘImportant traits for BitBoardpub fn file_bb(self) -> BitBoard
[src]
Returns the BitBoard
representation of a File
that a SQ
lies on.
pub const fn file_idx_of_sq(self) -> u8
[src]
Returns the file index (number) of a SQ
.
pub fn castle_rights_mask(self) -> u8
[src]
Returns the castle rights mask for the given square. If the square does not have a castle rights mask, returns 0.
pub fn make(file: File, rank: Rank) -> SQ
[src]
Creates a SQ
from the designated File and Rank.
Examples
use pleco::{SQ,Rank,File}; let file_f = File::F; let rank_2 = Rank::R2; let sq_f2 = SQ::F2; assert_eq!(sq_f2, SQ::make(file_f, rank_2));
pub fn on_dark_square(self) -> bool
[src]
Returns if the SQ
is a dark square.
pub fn on_light_square(self) -> bool
[src]
Returns if the SQ
is a dark square.
pub fn square_color_index(self) -> usize
[src]
Returns the player index of the color of the square.
pub fn flip(self) -> SQ
[src]
Flips the square's rank, so SQ::A1
-> SQ::A8
.
pub fn opposite_colors(self, other: SQ) -> bool
[src]
Determines if two squares are on opposite colors.
Trait Implementations
impl Eq for SQ
[src]
impl Copy for SQ
[src]
impl PartialOrd<SQ> for SQ
[src]
fn partial_cmp(&self, other: &SQ) -> Option<Ordering>
[src]
fn lt(&self, other: &SQ) -> bool
[src]
fn le(&self, other: &SQ) -> bool
[src]
fn gt(&self, other: &SQ) -> bool
[src]
fn ge(&self, other: &SQ) -> bool
[src]
impl Default for SQ
[src]
impl PartialEq<SQ> for SQ
[src]
impl From<u8> for SQ
[src]
impl From<SQ> for u8
[src]
impl Clone for SQ
[src]
fn clone(&self) -> SQ
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Display for SQ
[src]
impl Debug for SQ
[src]
impl Add<SQ> for SQ
[src]
impl Add<u8> for SQ
[src]
impl Sub<SQ> for SQ
[src]
impl Sub<u8> for SQ
[src]
impl Mul<SQ> for SQ
[src]
impl Mul<u8> for SQ
[src]
impl Div<SQ> for SQ
[src]
impl Div<u8> for SQ
[src]
impl Rem<SQ> for SQ
[src]
impl Rem<u8> for SQ
[src]
impl AddAssign<SQ> for SQ
[src]
fn add_assign(&mut self, rhs: SQ)
[src]
impl AddAssign<u8> for SQ
[src]
fn add_assign(&mut self, rhs: u8)
[src]
impl SubAssign<SQ> for SQ
[src]
fn sub_assign(&mut self, rhs: SQ)
[src]
impl SubAssign<u8> for SQ
[src]
fn sub_assign(&mut self, rhs: u8)
[src]
impl MulAssign<SQ> for SQ
[src]
fn mul_assign(&mut self, rhs: SQ)
[src]
impl MulAssign<u8> for SQ
[src]
fn mul_assign(&mut self, rhs: u8)
[src]
impl DivAssign<SQ> for SQ
[src]
fn div_assign(&mut self, rhs: SQ)
[src]
impl DivAssign<u8> for SQ
[src]
fn div_assign(&mut self, rhs: u8)
[src]
impl RemAssign<SQ> for SQ
[src]
fn rem_assign(&mut self, rhs: SQ)
[src]
impl RemAssign<u8> for SQ
[src]
fn rem_assign(&mut self, rhs: u8)
[src]
impl Not for SQ
[src]
impl BitAnd<SQ> for SQ
[src]
type Output = SQ
The resulting type after applying the &
operator.
fn bitand(self, rhs: SQ) -> SQ
[src]
impl BitAnd<u8> for SQ
[src]
type Output = SQ
The resulting type after applying the &
operator.
fn bitand(self, rhs: u8) -> SQ
[src]
impl BitOr<SQ> for SQ
[src]
type Output = SQ
The resulting type after applying the |
operator.
fn bitor(self, rhs: SQ) -> SQ
[src]
impl BitOr<u8> for SQ
[src]
type Output = SQ
The resulting type after applying the |
operator.
fn bitor(self, rhs: u8) -> SQ
[src]
impl BitXor<SQ> for SQ
[src]
type Output = SQ
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: SQ) -> SQ
[src]
impl BitXor<u8> for SQ
[src]
type Output = SQ
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: u8) -> SQ
[src]
impl Shl<usize> for SQ
[src]
type Output = SQ
The resulting type after applying the <<
operator.
fn shl(self, rhs: usize) -> SQ
[src]
impl Shl<SQ> for BitBoard
[src]
type Output = BitBoard
The resulting type after applying the <<
operator.
ⓘImportant traits for BitBoardfn shl(self, rhs: SQ) -> BitBoard
[src]
impl Shr<usize> for SQ
[src]
type Output = SQ
The resulting type after applying the >>
operator.
fn shr(self, rhs: usize) -> SQ
[src]
impl BitAndAssign<SQ> for SQ
[src]
fn bitand_assign(&mut self, rhs: SQ)
[src]
impl BitAndAssign<u8> for SQ
[src]
fn bitand_assign(&mut self, rhs: u8)
[src]
impl BitOrAssign<SQ> for SQ
[src]
fn bitor_assign(&mut self, rhs: SQ)
[src]
impl BitOrAssign<u8> for SQ
[src]
fn bitor_assign(&mut self, rhs: u8)
[src]
impl BitXorAssign<SQ> for SQ
[src]
fn bitxor_assign(&mut self, rhs: SQ)
[src]
impl BitXorAssign<u8> for SQ
[src]
fn bitxor_assign(&mut self, rhs: u8)
[src]
impl ShlAssign<usize> for SQ
[src]
fn shl_assign(&mut self, rhs: usize)
[src]
impl ShrAssign<usize> for SQ
[src]
fn shr_assign(&mut self, rhs: usize)
[src]
impl Hash for SQ
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,