Struct poirebot::game::position::Position [−][src]
Position on the board.
Fields
file_x: u8
The file index, 0 to 7 (maps A to H)
rank_y: u8
The rank index, 0 to 7 (maps 1 to 8)
Implementations
impl Position
[src]
pub fn new(file_x: u8, rank_y: u8) -> Result<Position>
[src]
Initialize a position from indexes.
pub fn from_notation(notation: &str) -> Result<Position>
[src]
Initialize a position from notation (for example: a8).
pub fn flip(&self) -> Self
[src]
Rotates the position for the other side.
pub fn forwards(&self, color: Color, inc: u8) -> Self
[src]
Returns a new position, forwards by increment in the direction of the given color.
pub fn backwards(&self, color: Color, inc: u8) -> Self
[src]
Returns a new position, backwards by increment in the direction of the given color.
pub fn distance_rank(&self, other: &Position) -> u8
[src]
Returns the distance between 2 positions on the Y axis (rank).
pub fn to_int(&self) -> u8
[src]
Convert to BitBoard
notation.
Trait Implementations
impl Clone for Position
[src]
impl Copy for Position
[src]
impl Debug for Position
[src]
impl Display for Position
[src]
impl Eq for Position
[src]
impl From<&'_ str> for Position
[src]
Converts from a notation &str
(e.g. "a1"
).
Note that this function panics if an invalid notation is given. Use Position::from_notation
for safer conversion.
impl From<(u8, u8)> for Position
[src]
Converts from (file, rank)
tuple.
Note that this function panics if an invalid values are given. Use Position::new
for safer conversion.
impl From<Position> for BitBoard
[src]
impl From<String> for Position
[src]
Converts from a notation String
(e.g. "a1"
).
Note that this function panics if an invalid notation is given. Use Position::from_notation
for safer conversion.
impl FromIterator<Position> for BitBoard
[src]
fn from_iter<T: IntoIterator<Item = Position>>(iter: T) -> Self
[src]
impl PartialEq<Position> for Position
[src]
impl StructuralEq for Position
[src]
impl StructuralPartialEq for Position
[src]
Auto Trait Implementations
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,