pub struct Selection { /* private fields */ }Expand description
A list of SelectionRanges — NEVER empty (enforced by keeping the
backing Vec private behind constructors that always seed one range).
TextInput/TextArea only ever populate the primary (last) range;
the list shape exists so a future multi-cursor widget is additive, not
a rewrite (D116).
Implementations§
Source§impl Selection
impl Selection
pub fn single(pos: usize) -> Self
pub fn range(anchor: usize, head: usize) -> Self
Sourcepub fn primary(&self) -> &SelectionRange
pub fn primary(&self) -> &SelectionRange
The primary (most-recently-active) range — for single-cursor widgets, the only one that exists.
pub fn primary_range(&self) -> (usize, usize)
pub fn ranges(&self) -> &[SelectionRange]
Trait Implementations§
impl StructuralPartialEq for Selection
Auto Trait Implementations§
impl Freeze for Selection
impl RefUnwindSafe for Selection
impl Send for Selection
impl Sync for Selection
impl Unpin for Selection
impl UnsafeUnpin for Selection
impl UnwindSafe for Selection
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