pub struct UserPresence { /* private fields */ }Expand description
User presence information for collaborative UI.
Tracks cursor position, selection, and user metadata for rendering remote user cursors.
Implementations§
Source§impl UserPresence
impl UserPresence
Sourcepub fn new(user_id: &str, user_name: &str, color: &str) -> Self
pub fn new(user_id: &str, user_name: &str, color: &str) -> Self
Create a new user presence.
§Arguments
user_id- Unique user identifieruser_name- Display namecolor- Hex color for cursor (e.g., “#FF6B6B”)
Sourcepub fn set_cursor(&mut self, position: usize)
pub fn set_cursor(&mut self, position: usize)
Set cursor position (clears selection).
Sourcepub fn set_selection(&mut self, start: usize, end: usize)
pub fn set_selection(&mut self, start: usize, end: usize)
Set selection range.
Sourcepub fn selection_start(&self) -> Option<usize>
pub fn selection_start(&self) -> Option<usize>
Get selection start.
Sourcepub fn selection_end(&self) -> Option<usize>
pub fn selection_end(&self) -> Option<usize>
Get selection end.
Sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Check if user has a selection (not just cursor).
Trait Implementations§
Source§impl From<UserPresence> for JsValue
impl From<UserPresence> for JsValue
Source§fn from(value: UserPresence) -> Self
fn from(value: UserPresence) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for UserPresence
impl FromWasmAbi for UserPresence
Source§impl IntoWasmAbi for UserPresence
impl IntoWasmAbi for UserPresence
Source§impl LongRefFromWasmAbi for UserPresence
impl LongRefFromWasmAbi for UserPresence
Source§impl OptionFromWasmAbi for UserPresence
impl OptionFromWasmAbi for UserPresence
Source§impl OptionIntoWasmAbi for UserPresence
impl OptionIntoWasmAbi for UserPresence
Source§impl RefFromWasmAbi for UserPresence
impl RefFromWasmAbi for UserPresence
Source§type Anchor = RcRef<UserPresence>
type Anchor = RcRef<UserPresence>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for UserPresence
impl RefMutFromWasmAbi for UserPresence
Source§impl TryFromJsValue for UserPresence
impl TryFromJsValue for UserPresence
Source§impl VectorFromWasmAbi for UserPresence
impl VectorFromWasmAbi for UserPresence
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[UserPresence]>
Source§impl VectorIntoWasmAbi for UserPresence
impl VectorIntoWasmAbi for UserPresence
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[UserPresence]>) -> Self::Abi
Source§impl WasmDescribeVector for UserPresence
impl WasmDescribeVector for UserPresence
impl SupportsConstructor for UserPresence
impl SupportsInstanceProperty for UserPresence
impl SupportsStaticProperty 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 UnsafeUnpin 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
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.