pub struct TextSelection { /* private fields */ }Expand description
UTF-8 byte-indexed text selection pairing an anchor offset with the active caret focus offset.
Implementations§
Source§impl TextSelection
Range helpers for TextSelection.
impl TextSelection
Range helpers for TextSelection.
Sourcepub fn start(&self) -> usize
pub fn start(&self) -> usize
Returns the smaller (inclusive start) UTF-8 byte offset of the selection.
§Returns
usize- Ordered start byte offset.
Sourcepub fn end(&self) -> usize
pub fn end(&self) -> usize
Returns the larger (exclusive end) UTF-8 byte offset of the selection.
§Returns
usize- Ordered end byte offset.
Sourcepub fn is_collapsed(&self) -> bool
pub fn is_collapsed(&self) -> bool
Returns true when the selection has zero width (anchor == focus).
§Returns
bool-truewhen collapsed to a caret.
Source§impl TextSelection
Implements impl #impl_generics #name #ty_generics #where_clause.
impl TextSelection
Implements impl #impl_generics #name #ty_generics #where_clause.
pub fn get_anchor(&self) -> usize
pub fn get_mut_anchor(&mut self) -> &mut usize
pub fn set_anchor(&mut self, val: usize) -> &mut Self
pub fn get_focus(&self) -> usize
pub fn get_mut_focus(&mut self) -> &mut usize
pub fn set_focus(&mut self, val: usize) -> &mut Self
Trait Implementations§
Source§impl Clone for TextSelection
impl Clone for TextSelection
impl Copy for TextSelection
Source§impl Debug for TextSelection
impl Debug for TextSelection
Source§impl Default for TextSelection
impl Default for TextSelection
impl Eq for TextSelection
Source§impl Hash for TextSelection
impl Hash for TextSelection
Source§impl PartialEq for TextSelection
impl PartialEq for TextSelection
impl StructuralPartialEq for TextSelection
Auto Trait Implementations§
impl Forget for TextSelection
impl Freeze for TextSelection
impl Move for TextSelection
impl RefUnwindSafe for TextSelection
impl Send for TextSelection
impl Sync for TextSelection
impl Unpin for TextSelection
impl UnsafeUnpin for TextSelection
impl UnwindSafe for TextSelection
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