pub struct Lobby {
pub id: LobbyId,
pub name: String,
pub host_id: PlayerId,
pub players: Vec<LobbyPlayer>,
pub state: LobbyState,
pub config: LobbyConfig,
/* private fields */
}Expand description
A single server-side lobby instance.
Fields§
§id: LobbyId§name: String§host_id: PlayerId§players: Vec<LobbyPlayer>§state: LobbyState§config: LobbyConfigImplementations§
Source§impl Lobby
impl Lobby
pub fn new( id: LobbyId, name: impl Into<String>, host_id: PlayerId, config: LobbyConfig, ) -> Self
Sourcepub fn has_min_players(&self) -> bool
pub fn has_min_players(&self) -> bool
Returns true if the lobby has enough players to start.
pub fn all_ready(&self) -> bool
pub fn player(&self, id: PlayerId) -> Option<&LobbyPlayer>
pub fn player_mut(&mut self, id: PlayerId) -> Option<&mut LobbyPlayer>
pub fn contains(&self, id: PlayerId) -> bool
Sourcepub fn tick_countdown(&mut self, dt: f32) -> bool
pub fn tick_countdown(&mut self, dt: f32) -> bool
Tick the countdown; returns true when countdown expires.
pub fn player_count(&self) -> usize
pub fn spectator_count(&self) -> usize
pub fn active_count(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Lobby
impl RefUnwindSafe for Lobby
impl Send for Lobby
impl Sync for Lobby
impl Unpin for Lobby
impl UnsafeUnpin for Lobby
impl UnwindSafe for Lobby
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.