pub struct Room {Show 20 fields
pub room_id: String,
pub room_name: String,
pub protocol_version: u32,
pub host_player_id: String,
pub host_username: String,
pub hosted: bool,
pub official: bool,
pub password: Option<String>,
pub max_players: u8,
pub format: GameFormat,
pub engine: EngineKind,
pub status: RoomStatus,
pub players: Vec<RoomSlot>,
pub observers: Vec<RoomObserver>,
pub draft_config: Option<DraftConfig>,
pub sealed_config: Option<SealedConfig>,
pub reconnect_timeout_s: u32,
pub replay: Option<GameReplayCache>,
pub resume_token: String,
pub humanless_since: Option<Instant>,
}Fields§
§room_id: String§room_name: String§protocol_version: u32§host_player_id: String§host_username: String§hosted: bool§official: bool§password: Option<String>§max_players: u8§format: GameFormat§engine: EngineKind§status: RoomStatus§players: Vec<RoomSlot>§observers: Vec<RoomObserver>§draft_config: Option<DraftConfig>§sealed_config: Option<SealedConfig>§reconnect_timeout_s: u32§replay: Option<GameReplayCache>§resume_token: String§humanless_since: Option<Instant>Implementations§
Source§impl Room
impl Room
pub fn new( room_id: String, room_name: String, protocol_version: u32, host_player_id: String, host_username: String, max_players: u8, format: GameFormat, engine: EngineKind, host_plays: bool, draft_config: Option<DraftConfig>, sealed_config: Option<SealedConfig>, official: bool, password: Option<String>, reconnect_timeout_s: u32, ) -> Self
pub fn is_full(&self) -> bool
pub fn is_empty(&self) -> bool
pub fn is_limited_session(&self) -> bool
pub fn reset_lobby_settings(&mut self)
pub fn all_ready(&self) -> bool
pub fn add_player( &mut self, player_id: String, username: String, is_bot: bool, ) -> Result<(), String>
pub fn add_observer( &mut self, player_id: String, _username: String, ) -> Result<(), String>
pub fn remove_player(&mut self, player_id: &str) -> Option<RoomSlot>
pub fn remove_observer(&mut self, player_id: &str) -> Option<RoomObserver>
pub fn remove_participant(&mut self, player_id: &str) -> bool
pub fn set_connected(&mut self, player_id: &str, connected: bool)
Sourcepub fn all_disconnected(&self) -> bool
pub fn all_disconnected(&self) -> bool
Forward-ported for future use when room cleanup logic is implemented.
pub fn has_connected_human(&self) -> bool
pub fn set_ready(&mut self, player_id: &str, ready: bool) -> Result<(), String>
pub fn set_deck_selection( &mut self, player_id: &str, deck_name: String, deck: Deck, published_deck_id: Option<String>, commander_name: Option<String>, avatar: Option<String>, ) -> Result<(), String>
pub fn has_selected_deck(&self, player_id: &str) -> bool
pub fn player_decks(&self) -> Vec<PlayerDeckInfo>
pub fn is_host(&self, player_id: &str) -> bool
Sourcepub fn controller_id(&self) -> Option<&str>
pub fn controller_id(&self) -> Option<&str>
The room controller is the first human (non-bot) player to take a seat.
They drive the lobby (format, seats, bots, start) regardless of who holds
the engine (host). Computed dynamically from current seats, so if the
controlling human leaves, control passes to the next human — never to a
bot. Falls back to the first seat only if every player is a bot.
pub fn is_controller(&self, player_id: &str) -> bool
pub fn host_username(&self) -> String
pub fn host_is_player(&self) -> bool
pub fn host_connected(&self) -> bool
pub fn player_usernames(&self) -> Vec<String>
Sourcepub fn player_ids(&self) -> Vec<String>
pub fn player_ids(&self) -> Vec<String>
Forward-ported for future use when full player ID tracking is needed.
pub fn connected_player_ids(&self) -> Vec<String>
pub fn to_room_info(&self) -> RoomInfo
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Room
impl RefUnwindSafe for Room
impl Send for Room
impl Sync for Room
impl Unpin for Room
impl UnsafeUnpin for Room
impl UnwindSafe for Room
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more