From effbdeed66e8de8e769b8ac069926ad1a9110e62 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sun, 14 Feb 2021 00:06:14 +0100 Subject: rstnode: refactoring server and client components into rst-core * Add an inbox/ outbox system to server components * Define a data flow from Request -> computation -> Update * Create simple handlers to call server or client code for requests --- games/rstnode/rst-client/src/state/if_impl.rs | 70 +++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 games/rstnode/rst-client/src/state/if_impl.rs (limited to 'games/rstnode/rst-client/src/state/if_impl.rs') diff --git a/games/rstnode/rst-client/src/state/if_impl.rs b/games/rstnode/rst-client/src/state/if_impl.rs new file mode 100644 index 000000000000..38bac369d3cc --- /dev/null +++ b/games/rstnode/rst-client/src/state/if_impl.rs @@ -0,0 +1,70 @@ +#![allow(unused)] + +use super::ClientState; +use async_trait::async_trait; +use chrono::{DateTime, Utc}; +use rst_core::{ + wire::{ + game::Action, AuthErr, Lobby, LobbyErr, LobbyId, LobbyUpdate, MatchErr, MatchId, RegErr, + UpdateState, User, UserId, + }, + GameIf, Match, +}; +use std::sync::Arc; + +#[async_trait] +impl GameIf for ClientState { + async fn register(self: Arc, name: String, pw: String) -> Result { + todo!() + } + + async fn login(self: Arc, name: String, pw: String) -> Result { + todo!() + } + + async fn logout(self: Arc, user: User) -> Result<(), AuthErr> { + todo!() + } + + async fn anonymous(self: Arc, name: String) -> Result { + todo!() + } + + async fn join(self: Arc, user: User, lobby: LobbyId) -> Result { + todo!() + } + + async fn leave(self: Arc, user: User, lobby: LobbyId) -> Result<(), LobbyErr> { + todo!() + } + + async fn ready( + self: Arc, + user: User, + lobby: LobbyId, + ready: bool, + ) -> Result { + todo!() + } + + async fn start_req( + self: Arc, + user: UserId, + lobby: LobbyId, + ) -> Result, LobbyErr> { + todo!() + } + + async fn perform_action( + self: Arc, + user: User, + mtch: MatchId, + act: Action, + ) -> UpdateState { + todo!() + } + + async fn leave_match(self: Arc, user: User, mtch: MatchId) -> Result<(), MatchErr> { + todo!() + } +} -- cgit v1.2.3