pub struct Range {
pub anchor: usize,
pub head: usize,
}Expand description
A selection with a fixed anchor and a moving head, in char offsets.
head < anchor is legal and means the selection was dragged backwards — the direction
is information (it decides which end moves next), so it is preserved rather than
normalized away.
Fields§
§anchor: usize§head: usizeImplementations§
Source§impl Range
impl Range
pub fn new(anchor: usize, head: usize) -> Self
pub fn is_empty(&self) -> bool
pub fn start(&self) -> usize
pub fn end(&self) -> usize
pub fn len(&self) -> usize
Sourcepub fn map(&self, changes: &ChangeSet) -> Self
pub fn map(&self, changes: &ChangeSet) -> Self
Carry this range through a change made elsewhere in the document.
The head maps with Assoc::After so that typing at the cursor pushes it along
rather than leaving it stranded behind the character just inserted.
Trait Implementations§
impl Copy for Range
impl Eq for Range
impl StructuralPartialEq for Range
Auto Trait Implementations§
impl Freeze for Range
impl RefUnwindSafe for Range
impl Send for Range
impl Sync for Range
impl Unpin for Range
impl UnsafeUnpin for Range
impl UnwindSafe for Range
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