pub struct TextRange {
pub start: usize,
pub end: usize,
}Expand description
A range of text measured in byte offsets, matching Compose’s TextRange.
When start == end, the range is collapsed (cursor position).
When start > end, the range is reversed (selection direction matters).
Fields§
§start: usize§end: usizeImplementations§
Source§impl TextRange
impl TextRange
pub const ZERO: TextRange
pub fn new(start: usize, end: usize) -> Self
pub fn collapsed(at: usize) -> Self
pub fn min(self) -> usize
pub fn max(self) -> usize
pub fn is_collapsed(self) -> bool
pub fn reversed(self) -> bool
pub fn length(self) -> usize
pub fn intersects(self, other: TextRange) -> bool
pub fn contains(self, offset: usize) -> bool
pub fn coerce_in(self, min: usize, max: usize) -> Self
Trait Implementations§
impl Copy for TextRange
impl Eq for TextRange
impl StructuralPartialEq for TextRange
Auto Trait Implementations§
impl Freeze for TextRange
impl RefUnwindSafe for TextRange
impl Send for TextRange
impl Sync for TextRange
impl Unpin for TextRange
impl UnsafeUnpin for TextRange
impl UnwindSafe for TextRange
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