pub struct RoomManager { /* private fields */ }Expand description
Manages a collection of Rooms.
Implementations§
Source§impl RoomManager
impl RoomManager
Sourcepub fn with_config(config: &WsConfig) -> Self
pub fn with_config(config: &WsConfig) -> Self
Create an empty manager whose default capacity comes from WsConfig.
Sourcepub fn get_or_create(&self, room_id: &str) -> Arc<Room> ⓘ
pub fn get_or_create(&self, room_id: &str) -> Arc<Room> ⓘ
Get an existing room or create a new one with the manager’s default capacity.
Sourcepub fn get_or_create_with_capacity(
&self,
room_id: &str,
capacity: usize,
) -> Arc<Room> ⓘ
pub fn get_or_create_with_capacity( &self, room_id: &str, capacity: usize, ) -> Arc<Room> ⓘ
Get an existing room or create with custom capacity.
Sourcepub fn remove(&self, room_id: &str) -> Option<Arc<Room>>
pub fn remove(&self, room_id: &str) -> Option<Arc<Room>>
Remove a room by id, returning it if present.
Sourcepub fn room_count(&self) -> usize
pub fn room_count(&self) -> usize
Number of rooms.
Sourcepub fn total_participants(&self) -> usize
pub fn total_participants(&self) -> usize
Total participants across all rooms.
Sourcepub fn cleanup_empty(&self) -> usize
pub fn cleanup_empty(&self) -> usize
Remove all rooms with zero participants (regardless of receivers). Returns number removed.
Trait Implementations§
Source§impl Debug for RoomManager
impl Debug for RoomManager
Auto Trait Implementations§
impl !RefUnwindSafe for RoomManager
impl !UnwindSafe for RoomManager
impl Freeze for RoomManager
impl Send for RoomManager
impl Sync for RoomManager
impl Unpin for RoomManager
impl UnsafeUnpin for RoomManager
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