pub struct Room {
pub id: String,
/* private fields */
}Expand description
A single broadcast room.
Fields§
§id: StringRoom identifier.
Implementations§
Source§impl Room
impl Room
Sourcepub fn new(id: impl Into<String>, capacity: usize) -> Self
pub fn new(id: impl Into<String>, capacity: usize) -> Self
Create a new room with the given id and broadcast capacity.
Sourcepub fn broadcast(&self, msg: String) -> Result<usize, WsError>
pub fn broadcast(&self, msg: String) -> Result<usize, WsError>
Broadcast a text message to all participants.
Sourcepub fn participant_count(&self) -> usize
pub fn participant_count(&self) -> usize
Number of tracked participants.
Sourcepub fn receiver_count(&self) -> usize
pub fn receiver_count(&self) -> usize
Number of active broadcast receivers.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Room
impl Freeze for Room
impl Send for Room
impl Sync for Room
impl Unpin for Room
impl UnsafeUnpin for Room
impl UnwindSafe for Room
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