pub trait PlayerContext: Send + Sync {
// Required methods
fn send_message<'life0, 'async_trait>(
&'life0 self,
msg: ServerMessage,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn identity(&self) -> &dyn PlayerIdentity;
fn is_admin(&self) -> bool;
fn lobby_id(&self) -> Option<&str>;
fn game_id(&self) -> Option<&str>;
fn is_spectating(&self) -> bool;
fn is_connected(&self) -> bool;
// Provided methods
fn player_id(&self) -> i64 { ... }
fn in_lobby(&self) -> bool { ... }
fn in_game(&self) -> bool { ... }
}Required Methods§
fn send_message<'life0, 'async_trait>(
&'life0 self,
msg: ServerMessage,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn identity(&self) -> &dyn PlayerIdentity
fn identity(&self) -> &dyn PlayerIdentity
Get the player’s identity.
Sourcefn is_spectating(&self) -> bool
fn is_spectating(&self) -> bool
Check if the player is spectating.
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if the player is connected.