pub struct Position<V> { /* private fields */ }Expand description
A position in the board (eff., a coordinate pair).
Implementations§
Source§impl<V> Position<V>where
V: BoardValue,
impl<V> Position<V>where
V: BoardValue,
Sourcepub fn as_index(&self, dim: &Dimensions<V>) -> Option<usize>
pub fn as_index(&self, dim: &Dimensions<V>) -> Option<usize>
The position encoded as an index into an board with the provided dimensions.
Trait Implementations§
Source§impl<V> Add for Position<V>where
V: BoardValue,
impl<V> Add for Position<V>where
V: BoardValue,
Source§impl<V> AddAssign for Position<V>where
V: BoardValue,
impl<V> AddAssign for Position<V>where
V: BoardValue,
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl<V> CheckedAdd for Position<V>where
V: BoardValue,
impl<V> CheckedAdd for Position<V>where
V: BoardValue,
Source§fn checked_add(&self, rhs: &Self) -> Option<Self>
fn checked_add(&self, rhs: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens,
None is
returned.Source§impl<V> CheckedSub for Position<V>where
V: BoardValue,
impl<V> CheckedSub for Position<V>where
V: BoardValue,
Source§fn checked_sub(&self, rhs: &Self) -> Option<Self>
fn checked_sub(&self, rhs: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens,
None is returned.Source§impl<'de, V> Deserialize<'de> for Position<V>where
V: Deserialize<'de>,
impl<'de, V> Deserialize<'de> for Position<V>where
V: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<V> Sub for Position<V>where
V: BoardValue,
impl<V> Sub for Position<V>where
V: BoardValue,
impl<V: Copy> Copy for Position<V>
Auto Trait Implementations§
impl<V> Freeze for Position<V>where
V: Freeze,
impl<V> RefUnwindSafe for Position<V>where
V: RefUnwindSafe,
impl<V> Send for Position<V>where
V: Send,
impl<V> Sync for Position<V>where
V: Sync,
impl<V> Unpin for Position<V>where
V: Unpin,
impl<V> UnsafeUnpin for Position<V>where
V: UnsafeUnpin,
impl<V> UnwindSafe for Position<V>where
V: UnwindSafe,
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