pub struct Selections { /* private fields */ }Expand description
A non-empty set of selections, sorted by position, never overlapping. One of them is primary: it scrolls into view and receives single-cursor commands.
Implementations§
Source§impl Selections
impl Selections
pub fn single(sel: Selection) -> Self
Sourcepub fn new(ranges: Vec<Selection>, primary: usize) -> Self
pub fn new(ranges: Vec<Selection>, primary: usize) -> Self
Builds a normalized set. Overlapping selections, and a cursor touching another selection, are merged.
§Panics
If ranges is empty or primary is out of bounds.
pub fn iter(&self) -> Iter<'_, Selection> ⓘ
pub fn as_slice(&self) -> &[Selection]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn primary(&self) -> Selection
pub fn primary_index(&self) -> usize
Trait Implementations§
Source§impl Clone for Selections
impl Clone for Selections
Source§impl Debug for Selections
impl Debug for Selections
impl Eq for Selections
Source§impl PartialEq for Selections
impl PartialEq for Selections
impl StructuralPartialEq for Selections
Auto Trait Implementations§
impl Forget for Selections
impl Freeze for Selections
impl Move for Selections
impl RefUnwindSafe for Selections
impl Send for Selections
impl Sync for Selections
impl Unpin for Selections
impl UnsafeUnpin for Selections
impl UnwindSafe for Selections
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