pub struct SelectionAnchor {
pub granularity: SelectionGranularity,
pub start: usize,
pub end: usize,
}Expand description
What a press selected, kept while the pointer stays down so a drag grows the selection in the same unit: a double click then drag selects whole words, a triple click whole lines.
Fields§
§granularity: SelectionGranularityThe unit the press selected.
start: usizeByte offset where the pressed unit starts.
end: usizeByte offset where the pressed unit ends.
Implementations§
Source§impl SelectionAnchor
impl SelectionAnchor
Sourcepub fn at(text: &str, pos: usize, granularity: SelectionGranularity) -> Self
pub fn at(text: &str, pos: usize, granularity: SelectionGranularity) -> Self
The unit at pos that granularity selects, as a press there selects it.
Sourcepub fn dragged_to(self, text: &str, pos: usize) -> TextRange
pub fn dragged_to(self, text: &str, pos: usize) -> TextRange
The selection a drag from this press to pos makes: the pressed unit
together with the unit under pos, anchored at the far side of the
pressed unit so the selection grows the way the pointer moves.
Trait Implementations§
Source§impl Clone for SelectionAnchor
impl Clone for SelectionAnchor
impl Copy for SelectionAnchor
Source§impl Debug for SelectionAnchor
impl Debug for SelectionAnchor
impl Eq for SelectionAnchor
Source§impl PartialEq for SelectionAnchor
impl PartialEq for SelectionAnchor
impl StructuralPartialEq for SelectionAnchor
Auto Trait Implementations§
impl Freeze for SelectionAnchor
impl RefUnwindSafe for SelectionAnchor
impl Send for SelectionAnchor
impl Sync for SelectionAnchor
impl Unpin for SelectionAnchor
impl UnsafeUnpin for SelectionAnchor
impl UnwindSafe for SelectionAnchor
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