pub struct Awareness { /* private fields */ }Expand description
Awareness manager tracking all client states
Implementations§
Source§impl Awareness
impl Awareness
Sourcepub fn get_states(&self) -> &HashMap<String, AwarenessState>
pub fn get_states(&self) -> &HashMap<String, AwarenessState>
Get all current client states
Sourcepub fn get_state(&self, client_id: &str) -> Option<&AwarenessState>
pub fn get_state(&self, client_id: &str) -> Option<&AwarenessState>
Get state for a specific client
Sourcepub fn get_local_state(&self) -> Option<&AwarenessState>
pub fn get_local_state(&self) -> Option<&AwarenessState>
Get local client’s state
Sourcepub fn set_local_state(&mut self, state: Value) -> AwarenessUpdate
pub fn set_local_state(&mut self, state: Value) -> AwarenessUpdate
Set local client’s state (returns update to broadcast)
Sourcepub fn apply_update(&mut self, update: AwarenessUpdate)
pub fn apply_update(&mut self, update: AwarenessUpdate)
Apply remote awareness update
Sourcepub fn remove_stale_clients(&mut self, timeout: Duration) -> Vec<String>
pub fn remove_stale_clients(&mut self, timeout: Duration) -> Vec<String>
Remove clients that haven’t updated within timeout Returns list of removed client IDs
Sourcepub fn create_leave_update(&self) -> AwarenessUpdate
pub fn create_leave_update(&self) -> AwarenessUpdate
Create update to signal local client leaving
Sourcepub fn client_count(&self) -> usize
pub fn client_count(&self) -> usize
Get number of online clients (including self)
Sourcepub fn other_client_count(&self) -> usize
pub fn other_client_count(&self) -> usize
Get number of online clients excluding self
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Awareness
impl RefUnwindSafe for Awareness
impl Send for Awareness
impl Sync for Awareness
impl Unpin for Awareness
impl UnwindSafe for Awareness
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