pub struct RoomManager { /* private fields */ }Expand description
房间管理器
Implementations§
Source§impl RoomManager
impl RoomManager
Sourcepub async fn create_room(&self, room_id: &str)
pub async fn create_room(&self, room_id: &str)
创建房间
Sourcepub async fn delete_room(&self, room_id: &str) -> Option<Vec<ConnectionId>>
pub async fn delete_room(&self, room_id: &str) -> Option<Vec<ConnectionId>>
删除房间
Sourcepub async fn get_members(&self, room_id: &str) -> Vec<ConnectionId> ⓘ
pub async fn get_members(&self, room_id: &str) -> Vec<ConnectionId> ⓘ
获取房间内的所有连接
Sourcepub async fn room_exists(&self, room_id: &str) -> bool
pub async fn room_exists(&self, room_id: &str) -> bool
检查房间是否存在
Sourcepub async fn room_count(&self) -> usize
pub async fn room_count(&self) -> usize
获取房间数量
Sourcepub async fn member_count(&self, room_id: &str) -> usize
pub async fn member_count(&self, room_id: &str) -> usize
获取房间成员数量
Sourcepub async fn broadcast(
&self,
room_id: &str,
sender: &Sender,
message: &Message,
) -> WebSocketResult<Vec<ConnectionId>>
pub async fn broadcast( &self, room_id: &str, sender: &Sender, message: &Message, ) -> WebSocketResult<Vec<ConnectionId>>
广播消息到房间
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoomManager
impl !RefUnwindSafe for RoomManager
impl Send for RoomManager
impl Sync for RoomManager
impl Unpin for RoomManager
impl UnsafeUnpin for RoomManager
impl !UnwindSafe 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