Struct RoomManager

Source
pub struct RoomManager { /* private fields */ }
Expand description

Manages active rooms and room codes.

Implementations§

Source§

impl RoomManager

Source

pub fn new() -> Self

Create a new room manager with default configuration.

Source

pub fn with_config(config: RoomConfig) -> Self

Create a new room manager with custom configuration.

Source

pub fn create_room(&mut self) -> String

Generate a new room code and create the room.

Source

pub fn room_exists(&self, code: &str) -> bool

Check if a room code is valid.

Source

pub fn client_count(&self, code: &str) -> Option<usize>

Get the number of clients in a room.

Source

pub fn join_room( &mut self, code: &str, node_id: NodeId, client_name: Option<String>, ) -> Result<()>

Validate a room code and add client.

Source

pub fn leave_room(&mut self, code: &str, node_id: NodeId) -> bool

Remove a client from their room.

Source

pub fn update_activity(&mut self, code: &str, node_id: NodeId)

Update client activity timestamp.

Source

pub fn get_room_clients(&self, code: &str) -> Vec<NodeId>

Get all node IDs in a room.

Source

pub fn close_room(&mut self, code: &str) -> Vec<NodeId>

Close a room and return all client node IDs.

Source

pub fn cleanup_expired(&mut self) -> usize

Clean up expired rooms.

Returns the number of rooms removed.

Source

pub fn room_count(&self) -> usize

Get the total number of active rooms.

Trait Implementations§

Source§

impl Default for RoomManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

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

§

fn vzip(self) -> V