diff options
Diffstat (limited to 'src/_if.rs')
-rw-r--r-- | src/_if.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/_if.rs b/src/_if.rs index 91cb3a2daf18..59d80fb165af 100644 --- a/src/_if.rs +++ b/src/_if.rs @@ -1,11 +1,11 @@ //! A common trait interface between the server and the client use crate::wire::{ - Action, AuthErr, Lobby, LobbyId, MatchErr, MatchId, RegErr, RoomErr, RoomUpdate, UpdateState, + Action, AuthErr, Lobby, LobbyErr, LobbyId, LobbyUpdate, MatchErr, MatchId, RegErr, UpdateState, User, UserId, }; -use async_trait::async_trait; use async_std::sync::Arc; +use async_trait::async_trait; use chrono::{DateTime, Utc}; /// The main game interface implemented by the server and client @@ -24,19 +24,25 @@ pub trait GameIf { async fn anonymous(self: Arc<Self>, name: String) -> Result<User, AuthErr>; /// Join a match-making lobby - async fn join(self: Arc<Self>, user: User, lobby: LobbyId) -> Result<Lobby, RoomErr>; + async fn join(self: Arc<Self>, user: User, lobby: LobbyId) -> Result<Lobby, LobbyErr>; /// Leave a match-making lobby - async fn leave(self: Arc<Self>, user: User, lobby: LobbyId) -> Result<(), RoomErr>; + async fn leave(self: Arc<Self>, user: User, lobby: LobbyId) -> Result<(), LobbyErr>; /// Set the player's ready state - async fn ready(self: Arc<Self>, user: User, lobby: LobbyId, ready: bool) -> RoomUpdate; + async fn ready( + self: Arc<Self>, + user: User, + lobby: LobbyId, + ready: bool, + ) -> Result<LobbyUpdate, LobbyErr>; /// Send a start request (as lobby admin) - async fn start_req(self: Arc<Self>, user: User, lobby: LobbyId) -> DateTime<Utc>; + async fn start_req(self: Arc<Self>, user: UserId, lobby: LobbyId) -> Result<DateTime<Utc>, LobbyErr>; /// Perform a game action as a user - async fn perform_action(self: Arc<Self>, user: User, mtch: MatchId, act: Action) -> UpdateState; + async fn perform_action(self: Arc<Self>, user: User, mtch: MatchId, act: Action) + -> UpdateState; /// Leave a match async fn leave_match(self: Arc<Self>, user: User, mtch: MatchId) -> Result<(), MatchErr>; |