Skip to main content

GameSnapshot

Struct GameSnapshot 

Source
pub struct GameSnapshot {
Show 16 fields pub game_id: String, pub game_type: GameType, pub state: GameState, pub grid: Grid, pub players: Vec<PlayerInfo>, pub spectators: Vec<SpectatorInfo>, pub current_turn: i64, pub round: u8, pub max_rounds: u8, pub used_words: Vec<String>, pub timer_vote_state: TimerVoteState, pub your_player: Option<PlayerInfo>, pub timer_expiration_time: Option<DateTime<Utc>>, pub custom: Option<CustomMeta>, pub time_remaining_ms: Option<u64>, pub your_found_words: Option<Vec<String>>,
}
Expand description

Complete snapshot of the game state.

Fields§

§game_id: String§game_type: GameType

Which mode this game is, so the snapshot is self-describing.

Without this a client has to infer the mode from indirect tells — the lobby games list, the joined pool, or the presence of a per-viewer field. That inference was load-bearing for RuneBox and it read the wrong thing more than once, so the type rides on the snapshot itself.

#[serde(default)] (→ GameType::Unknown) keeps a payload written before this field existed decodable; it is NOT an invitation to omit the field when building one. Every construction site must set it, which is why this is a plain field and not an Option.

§state: GameState§grid: Grid§players: Vec<PlayerInfo>§spectators: Vec<SpectatorInfo>§current_turn: i64§round: u8§max_rounds: u8§used_words: Vec<String>§timer_vote_state: TimerVoteState§your_player: Option<PlayerInfo>

Your player info (for the receiving client)

§timer_expiration_time: Option<DateTime<Utc>>

When the turn timer expires (if active)

§custom: Option<CustomMeta>

Some marks an unranked custom (sandbox) game, mirroring GameStarted.custom, so the unranked badge survives reconnect/spectate.

§time_remaining_ms: Option<u64>

Server-authoritative time left in a Daily Challenge run, in milliseconds. Mirrors GameStarted.time_remaining_ms so a daily run that recovers via the snapshot/reconnect path keeps its deadline. Omitted otherwise.

§your_found_words: Option<Vec<String>>

The receiving player’s own found words (RuneBox only).

Restores the word list after a reconnect. The authoritative score already rides on PlayerInfo, but without this a reconnecting player sees an empty list and gets a confusing “already found” when re-submitting a word they had already scored. Omitted for every other mode, whose found-words concept is the game-global used_words.

Trait Implementations§

Source§

impl Clone for GameSnapshot

Source§

fn clone(&self) -> GameSnapshot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GameSnapshot

Source§

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

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

impl<'de> Deserialize<'de> for GameSnapshot

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 GameSnapshot

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.