pub struct PlayerId(/* private fields */);Expand description
Identifies one seat in a match.
A seat is not necessarily a human: scripted opponents, a blackjack dealer,
and the reserved chance “player” (PlayerId::CHANCE) are all seats. Real
players are numbered from 0; games map their own seat concepts onto these
indices.
Implementations§
Source§impl PlayerId
impl PlayerId
Sourcepub const CHANCE: Self
pub const CHANCE: Self
The reserved chance pseudo-player.
Committed random outcomes (a card revealed, a hand dealt) are modeled as
actions taken by this seat, so they become real, undoable state rather
than an RNG side effect. See the chance-node design in ARCHITECTURE.md.
Real players must not use this index.
Sourcepub const fn new(index: u32) -> Self
pub const fn new(index: u32) -> Self
Creates a seat with the given index.
Indices should be small and dense (0, 1, 2, …); u32::MAX is reserved
for PlayerId::CHANCE.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PlayerId
impl<'de> Deserialize<'de> for PlayerId
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 FromIterator<PlayerId> for ActivePlayers
impl FromIterator<PlayerId> for ActivePlayers
Source§impl Ord for PlayerId
impl Ord for PlayerId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for PlayerId
impl PartialOrd for PlayerId
impl Copy for PlayerId
impl Eq for PlayerId
impl StructuralPartialEq for PlayerId
Auto Trait Implementations§
impl Freeze for PlayerId
impl RefUnwindSafe for PlayerId
impl Send for PlayerId
impl Sync for PlayerId
impl Unpin for PlayerId
impl UnsafeUnpin for PlayerId
impl UnwindSafe for PlayerId
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