pub struct UserPresence {
pub user_id: UserId,
pub info: UserInfo,
pub status: UserStatus,
pub cursors: HashMap<String, Cursor>,
pub state: HashMap<String, String>,
pub last_updated: u64,
pub timestamp: u64,
}Expand description
Presence data for a single user.
Fields§
§user_id: UserIdThe user ID.
info: UserInfoUser information.
status: UserStatusCurrent status.
cursors: HashMap<String, Cursor>Cursor positions by document ID.
state: HashMap<String, String>Custom user state data.
last_updated: u64Last update timestamp (milliseconds since epoch).
timestamp: u64Lamport timestamp for ordering.
Implementations§
Source§impl UserPresence
impl UserPresence
Sourcepub fn set_cursor(&mut self, document_id: impl Into<String>, cursor: Cursor)
pub fn set_cursor(&mut self, document_id: impl Into<String>, cursor: Cursor)
Update the cursor for a document.
Sourcepub fn remove_cursor(&mut self, document_id: &str)
pub fn remove_cursor(&mut self, document_id: &str)
Remove the cursor for a document.
Sourcepub fn get_cursor(&self, document_id: &str) -> Option<&Cursor>
pub fn get_cursor(&self, document_id: &str) -> Option<&Cursor>
Get the cursor for a document.
Sourcepub fn set_status(&mut self, status: UserStatus)
pub fn set_status(&mut self, status: UserStatus)
Set the status.
Trait Implementations§
Source§impl Clone for UserPresence
impl Clone for UserPresence
Source§fn clone(&self) -> UserPresence
fn clone(&self) -> UserPresence
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UserPresence
impl Debug for UserPresence
Source§impl<'de> Deserialize<'de> for UserPresence
impl<'de> Deserialize<'de> for UserPresence
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for UserPresence
impl PartialEq for UserPresence
Source§impl Serialize for UserPresence
impl Serialize for UserPresence
impl StructuralPartialEq for UserPresence
Auto Trait Implementations§
impl Freeze for UserPresence
impl RefUnwindSafe for UserPresence
impl Send for UserPresence
impl Sync for UserPresence
impl Unpin for UserPresence
impl UnwindSafe for UserPresence
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