Include a serde feature in the shared crate
This commit is contained in:
@@ -7,13 +7,13 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
futures = { version = "0.3" }
|
||||
board-shared = { path = "../board-shared" }
|
||||
board-shared = { path = "../board-shared", features = ["serde"] }
|
||||
board-network = { path = "../board-network" }
|
||||
smol = "1.3.0"
|
||||
async-tungstenite = "0.20.0"
|
||||
tungstenite = "0.18.0"
|
||||
smol = "2.0.0"
|
||||
async-tungstenite = "0.25.0"
|
||||
tungstenite = "0.21.0"
|
||||
anyhow = "1.0.69"
|
||||
rand = "0.8.5"
|
||||
serde_json = "1.0.93"
|
||||
redis = { version = "0.22.3", features = ["aio", "async-std-comp"] }
|
||||
redis = { version = "0.25.2", features = ["aio", "async-std-comp"] }
|
||||
async-trait = "0.1.66"
|
||||
|
@@ -1,6 +1,5 @@
|
||||
FROM rust:1.68.0-slim as builder
|
||||
FROM rust:1.77.0-slim as builder
|
||||
|
||||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
|
||||
WORKDIR /usr/src/board
|
||||
|
||||
# Build with musl to statically link
|
||||
|
@@ -29,13 +29,13 @@ impl RedisLeaderboard {
|
||||
#[async_trait]
|
||||
impl Leaderboard for RedisLeaderboard {
|
||||
async fn add_score(&self, player_name: &str, score: u32) -> Result<(), RedisError> {
|
||||
let mut con = self.client.get_async_connection().await?;
|
||||
let mut con = self.client.get_multiplexed_async_connection().await?;
|
||||
con.zadd(LEADERBOARD, player_name, score).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn get_highscores(&self) -> Result<Vec<LeaderboardEntry>, RedisError> {
|
||||
let mut con = self.client.get_async_connection().await?;
|
||||
let mut con = self.client.get_multiplexed_async_connection().await?;
|
||||
let count: isize = con.zcard(LEADERBOARD).await?;
|
||||
let leaderboard: Vec<LeaderboardEntry> = con
|
||||
.zrange_withscores(LEADERBOARD, 0, (count - 1).min(LEADERBOARD_SIZE))
|
||||
|
@@ -1,7 +1,6 @@
|
||||
use crate::leaderboard::{InMemoryLeaderboard, Leaderboard};
|
||||
use crate::player::Player;
|
||||
use board_network::protocol::{ClientMessage, ServerMessage};
|
||||
use board_network::types::TileRef;
|
||||
use board_shared::board::Board;
|
||||
use board_shared::deck::RngDeck;
|
||||
use board_shared::expr::is_valid_guess;
|
||||
@@ -87,7 +86,7 @@ impl Room {
|
||||
.iter()
|
||||
.map(|p| (p.name.clone(), p.score, p.ws.is_some()))
|
||||
.collect(),
|
||||
board: (&self.board).into(),
|
||||
board: self.board.clone(),
|
||||
active_player: self.active_player,
|
||||
has_started: self.has_started,
|
||||
})?;
|
||||
@@ -328,13 +327,7 @@ impl Room {
|
||||
fn sync_hand(&mut self, player_id: usize) {
|
||||
self.send(
|
||||
player_id,
|
||||
ServerMessage::SyncHand(
|
||||
self.players[player_id]
|
||||
.hand
|
||||
.iter()
|
||||
.map(|t| <Tile as Into<TileRef>>::into(*t))
|
||||
.collect::<Vec<_>>(),
|
||||
),
|
||||
ServerMessage::SyncHand(self.players[player_id].hand.tiles.clone()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user