Enum libcoinche::pos::PlayerPos
source · [−]pub enum PlayerPos {
P0,
P1,
P2,
P3,
}
Expand description
A position in the table
Variants
P0
Player 0
P1
Player 1
P2
Player 2
P3
Player 3
Implementations
sourceimpl PlayerPos
impl PlayerPos
sourcepub fn from_n(n: usize) -> Self
pub fn from_n(n: usize) -> Self
Returns the position corresponding to the number (0 => P0, …).
Panics if n > 3
.
sourcepub fn is_partner(self, other: PlayerPos) -> bool
pub fn is_partner(self, other: PlayerPos) -> bool
Returns true
if self
and other
and in the same team
sourcepub fn until_n(self, n: usize) -> PlayerIteratorⓘNotable traits for PlayerIteratorimpl Iterator for PlayerIterator type Item = PlayerPos;
pub fn until_n(self, n: usize) -> PlayerIteratorⓘNotable traits for PlayerIteratorimpl Iterator for PlayerIterator type Item = PlayerPos;
Returns an iterator that iterates on n
players, including this one.
sourcepub fn distance_until(self, other: PlayerPos) -> usize
pub fn distance_until(self, other: PlayerPos) -> usize
Returns the number of turns after self
to reach other
.
sourcepub fn until(self, other: PlayerPos) -> PlayerIteratorⓘNotable traits for PlayerIteratorimpl Iterator for PlayerIterator type Item = PlayerPos;
pub fn until(self, other: PlayerPos) -> PlayerIteratorⓘNotable traits for PlayerIteratorimpl Iterator for PlayerIterator type Item = PlayerPos;
Returns an iterator until the given player (self
included, other
excluded)
Trait Implementations
sourceimpl<'de> Deserialize<'de> for PlayerPos
impl<'de> Deserialize<'de> for PlayerPos
sourcefn 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
impl Copy for PlayerPos
impl Eq for PlayerPos
impl StructuralEq for PlayerPos
impl StructuralPartialEq for PlayerPos
Auto Trait Implementations
impl RefUnwindSafe for PlayerPos
impl Send for PlayerPos
impl Sync for PlayerPos
impl Unpin for PlayerPos
impl UnwindSafe for PlayerPos
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more