Enum libcoinche::pos::PlayerPos [] [src]

pub enum PlayerPos {
    P0,
    P1,
    P2,
    P3,
}

A position in the table

Variants

P0

Player 0

P1

Player 1

P2

Player 2

P3

Player 3

Methods

impl PlayerPos

fn team(self) -> Team

Returns the player's team

fn from_n(n: usize) -> Self

Returns the position corresponding to the number (0 => P0, ...).

Panics if n > 3.

fn is_partner(self, other: PlayerPos) -> bool

Returns true if self and other and in the same team

fn next(self) -> PlayerPos

Returns the next player in line

fn next_n(self, n: usize) -> PlayerPos

Returns the player n seats further

fn prev(self) -> PlayerPos

Returns the previous player.

fn until_n(self, n: usize) -> PlayerIterator

Returns an iterator that iterates on n players, including this one.

fn distance_until(self, other: PlayerPos) -> usize

Returns the number of turns after self to reach other.

fn until(self, other: PlayerPos) -> PlayerIterator

Returns an iterator until the given player (self included, other excluded)

Trait Implementations

impl Encodable for PlayerPos

fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error>

impl Decodable for PlayerPos

fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>

Derived Implementations

impl Debug for PlayerPos

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Copy for PlayerPos

impl Clone for PlayerPos

fn clone(&self) -> PlayerPos

fn clone_from(&mut self, source: &Self)

impl PartialEq for PlayerPos

fn eq(&self, __arg_0: &PlayerPos) -> bool

fn ne(&self, __arg_0: &PlayerPos) -> bool