Skip to main content

Message

Enum Message 

Source
pub enum Message {
Show 18 variants JoinServer { nickname: String, }, ServerJoined { nickname: String, chips: Chips, }, JoinTable, LeaveTable, TableJoined { table_id: TableId, chips: Chips, seats: u8, }, NoTablesLeft, NotEnoughChips, PlayerAlreadyJoined, PlayerJoined { player_id: PeerId, nickname: String, chips: Chips, }, ShowAccount { chips: Chips, }, StartGame(Vec<PeerId>), StartHand, EndHand { payoffs: Vec<HandPayoff>, board: Vec<Card>, cards: Vec<(PeerId, PlayerCards)>, }, DealCards(Card, Card), PlayerLeft(PeerId), GameUpdate { players: Vec<PlayerUpdate>, board: Vec<Card>, pot: Chips, }, ActionRequest { player_id: PeerId, min_raise: Chips, big_blind: Chips, actions: Vec<PlayerAction>, }, ActionResponse { action: PlayerAction, amount: Chips, },
}
Expand description

Message exchanged by a client and a server.

Variants§

§

JoinServer

Joins a server with a nickname.

Fields

§nickname: String

The player nickname.

§

ServerJoined

A player account information.

Fields

§nickname: String

The player nickname.

§chips: Chips

The chips amount for the player.

§

JoinTable

Join a table.

§

LeaveTable

Leave a table.

§

TableJoined

Table joined confirmation.

Fields

§table_id: TableId

The table the player joined.

§chips: Chips

The chips amount for the player who joined.

§seats: u8

The number of seats at this table.

§

NoTablesLeft

There are no tables left.

§

NotEnoughChips

The player doesn’t have enough chips to join a game.

§

PlayerAlreadyJoined

The player has already joined a table.

§

PlayerJoined

A player joined the table.

Fields

§player_id: PeerId

The player id.

§nickname: String

The player nickname.

§chips: Chips

The player chips.

§

ShowAccount

Show the account dialog.

Fields

§chips: Chips

The player chips.

§

StartGame(Vec<PeerId>)

Tell players the game is starting and update the seats order.

§

StartHand

Tell players to prepare for a new hand.

§

EndHand

Tell players the hand has completed and who won.

Fields

§payoffs: Vec<HandPayoff>

List of payoffs for the hand.

§board: Vec<Card>

The board cards.

§cards: Vec<(PeerId, PlayerCards)>

Players cards.

§

DealCards(Card, Card)

Deal cards to a player.

§

PlayerLeft(PeerId)

A player left the table.

§

GameUpdate

A game state update.

Fields

§players: Vec<PlayerUpdate>

The players update.

§board: Vec<Card>

The board cards.

§pot: Chips

The pot.

§

ActionRequest

Request action from a player.

Fields

§player_id: PeerId

The player that should respond with an action.

§min_raise: Chips

The minimum raise.

§big_blind: Chips

The current big blind.

§actions: Vec<PlayerAction>

The list of legal actions.

§

ActionResponse

Player action response.

Fields

§action: PlayerAction

The action from the player.

§amount: Chips

The amount for this action (only used for bet and raise actions)

Trait Implementations§

Source§

impl Debug for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Message

Source§

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 Serialize for Message

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V