pub struct Selection {
pub anchor: Position,
pub head: Position,
pub kind: SelectionKind,
}Expand description
A single cursor or selection.
Fields§
§anchor: PositionThe anchor (the end that does not move when extending).
head: PositionThe head (the moving end / where the caret is rendered).
kind: SelectionKindThe selection kind.
Implementations§
Source§impl Selection
impl Selection
Sourcepub const fn new(anchor: Position, head: Position, kind: SelectionKind) -> Self
pub const fn new(anchor: Position, head: Position, kind: SelectionKind) -> Self
Construct a selection from its anchor, head, and kind.
Sourcepub fn is_collapsed(&self) -> bool
pub fn is_collapsed(&self) -> bool
true when the selection has zero extent.
Sourcepub fn ordered_range(&self) -> Range
pub fn ordered_range(&self) -> Range
Return the covered range with start <= end.
Trait Implementations§
impl Copy for Selection
Source§impl<'de> Deserialize<'de> for Selection
impl<'de> Deserialize<'de> for Selection
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Selection
impl StructuralPartialEq for Selection
Auto Trait Implementations§
impl Forget for Selection
impl Freeze for Selection
impl Move 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