#[repr(C)]pub struct SelectionState {
pub selections: SelectionVec,
pub node_id: DomNodeId,
}Expand description
The complete selection state for a single text block, supporting multiple cursors/ranges.
Fields§
§selections: SelectionVecA list of all active selections. This list is kept sorted and non-overlapping.
node_id: DomNodeIdThe DOM node this selection state applies to.
Implementations§
Source§impl SelectionState
impl SelectionState
Sourcepub fn add(&mut self, new_selection: Selection)
pub fn add(&mut self, new_selection: Selection)
Adds a new selection, merging it with any existing selections it overlaps with.
Sourcepub fn set_cursor(&mut self, cursor: TextCursor)
pub fn set_cursor(&mut self, cursor: TextCursor)
Clears all selections and replaces them with a single cursor.
Trait Implementations§
Source§impl Clone for SelectionState
impl Clone for SelectionState
Source§fn clone(&self) -> SelectionState
fn clone(&self) -> SelectionState
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 SelectionState
impl Debug for SelectionState
Source§impl PartialEq for SelectionState
impl PartialEq for SelectionState
impl StructuralPartialEq for SelectionState
Auto Trait Implementations§
impl Freeze for SelectionState
impl RefUnwindSafe for SelectionState
impl Send for SelectionState
impl Sync for SelectionState
impl Unpin for SelectionState
impl UnwindSafe for SelectionState
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more