Struct shuuro::square::Square [−][src]
pub struct Square { /* fields omitted */ }
Expand description
Represents a position of each cell in the game board.
Examples
use shuuro::Square;
let sq = Square::new(4, 4).unwrap();
assert_eq!("e5", sq.to_string());
Square
can be created by parsing a SFEN formatted string as well.
use shuuro::Square;
let sq = Square::from_sfen("e5").unwrap();
assert_eq!(4, sq.file());
assert_eq!(4, sq.rank());
Implementations
Creates a new instance of Square
.
file
can take a value from 0(‘1’) to 11(‘12’), while rank
is from 0(‘a’) to 12(‘l’).
Creates a new instance of Square
from SFEN formatted string.
Creates a new instance of Square
with the given index value.
pub fn iter() -> SquareIterⓘNotable traits for SquareIterimpl Iterator for SquareIter type Item = Square;
pub fn iter() -> SquareIterⓘNotable traits for SquareIterimpl Iterator for SquareIter type Item = Square;
Notable traits for SquareIter
impl Iterator for SquareIter type Item = Square;
Returns an iterator of all variants.
Returns a new Square
instance by moving the file and the rank values.
Examples
use shuuro::square::consts::*;
let sq = B2;
let shifted = sq.shift(2, 3).unwrap();
assert_eq!(3, shifted.file());
assert_eq!(4, shifted.rank());
Returns a relative rank as if the specified color is Blue.
Tests if the square is in a promotion zone.
Trait Implementations
Performs the &=
operation. Read more
Performs the |=
operation. Read more
Performs the ^=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for Square
impl UnwindSafe for Square
Blanket Implementations
Mutably borrows from an owned value. Read more