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 with_stats(config: &WsConfig, stats: StatsRecorder) -> Self
pub fn with_stats(config: &WsConfig, stats: StatsRecorder) -> Self
Create an empty manager wired to a StatsRecorder: room
create/remove updates the room gauge, room broadcasts record
per-room + global outbound traffic and drops (0.4.0).
Sourcepub fn stats(&self) -> Option<&StatsRecorder>
pub fn stats(&self) -> Option<&StatsRecorder>
The recorder this manager reports to, if any.
Source§impl RoomManager
impl RoomManager
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 it with the manager’s default 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
Source§impl Default for RoomManager
impl Default for RoomManager
Source§impl RoomRegistry for RoomManager
impl RoomRegistry for RoomManager
Source§fn remove(&self, room_id: &str) -> Option<Arc<Room>>
fn remove(&self, room_id: &str) -> Option<Arc<Room>>
Remove a room by id, returning it if present.
Source§fn room_count(&self) -> usize
fn room_count(&self) -> usize
Number of rooms.
Source§fn total_participants(&self) -> usize
fn total_participants(&self) -> usize
Total participants across all rooms.
Source§fn cleanup(&self) -> usize
fn cleanup(&self) -> usize
Remove all empty rooms (no participants, no receivers). Returns
number removed.
Source§fn cleanup_empty(&self) -> usize
fn cleanup_empty(&self) -> usize
Remove all rooms with zero participants (regardless of receivers).
Returns number removed.
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