Skip to main content

Room

Struct Room 

Source
pub struct Room {
Show 27 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 table_style: Option<String>, pub replay: Option<GameReplayCache>, pub resume_token: String, pub humanless_since: Option<Instant>, pub limited_session_id: Option<String>, pub draft_clock: Option<DraftClock>, pub parent_limited_room: Option<String>, pub limited_matches: Vec<String>, pub transports: HashMap<String, TransportEndpoint>, pub chat: ChatHistory,
}

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§table_style: Option<String>§replay: Option<GameReplayCache>§resume_token: String§humanless_since: Option<Instant>§limited_session_id: Option<String>§draft_clock: Option<DraftClock>§parent_limited_room: Option<String>§limited_matches: Vec<String>§transports: HashMap<String, TransportEndpoint>

Announced endpoints by player id. Only the relay binds one to a username.

§chat: ChatHistory

Implementations§

Source§

impl Room

Source

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, table_style: Option<String>, ) -> Self

Source

pub fn is_full(&self) -> bool

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_limited_session(&self) -> bool

Source

pub fn reset_lobby_settings(&mut self)

Source

pub fn all_ready(&self) -> bool

Source

pub fn add_player( &mut self, player_id: String, username: String, is_bot: bool, ) -> Result<(), String>

Source

pub fn add_observer( &mut self, player_id: String, _username: String, ) -> Result<(), String>

Source

pub fn remove_player(&mut self, player_id: &str) -> Option<RoomSlot>

Source

pub fn remove_observer(&mut self, player_id: &str) -> Option<RoomObserver>

Source

pub fn remove_participant(&mut self, player_id: &str) -> bool

Source

pub fn set_connected(&mut self, player_id: &str, connected: bool)

Source

pub fn all_disconnected(&self) -> bool

Forward-ported for future use when room cleanup logic is implemented.

Source

pub fn has_connected_human(&self) -> bool

Source

pub fn set_ready(&mut self, player_id: &str, ready: bool) -> Result<(), String>

Source

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_url: Option<String>, ) -> Result<(), String>

Source

pub fn has_selected_deck(&self, player_id: &str) -> bool

Source

pub fn player_decks(&self) -> Vec<PlayerDeckInfo>

Source

pub fn is_host(&self, player_id: &str) -> bool

Source

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.

Source

pub fn is_controller(&self, player_id: &str) -> bool

Source

pub fn host_username(&self) -> String

Source

pub fn host_is_player(&self) -> bool

Source

pub fn host_connected(&self) -> bool

Source

pub fn player_usernames(&self) -> Vec<String>

Source

pub fn player_ids(&self) -> Vec<String>

Forward-ported for future use when full player ID tracking is needed.

Source

pub fn connected_player_ids(&self) -> Vec<String>

Source

pub fn to_room_info(&self) -> RoomInfo

Source§

impl Room

Source

pub fn participant_id_by_username(&self, username: &str) -> Option<String>

Seats and the host only; observers are not signalling targets.

Source

pub fn set_transport( &mut self, player_id: &str, endpoint: Option<TransportEndpoint>, ) -> bool

Records a member’s endpoint, or withdraws it with None. False means refused.

Source

pub fn transport_members(&self) -> Vec<TransportMember>

The attested roster; every username is the relay’s own record.

Source

pub fn transport_host(&self) -> Option<TransportMember>

Source

pub fn transport_consented(&self) -> bool

Whether every human seat has announced. Bots never count.

Trait Implementations§

Source§

impl Debug for Room

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more