pub struct TextRange {
pub start: usize,
pub end: usize,
}Expand description
a half-open interval in ℕ, [start, end)
Fields§
§start: usize§end: usizeImplementations§
Source§impl TextRange
impl TextRange
pub fn as_range(&self) -> Range<usize>
pub fn contains(&self, pos: usize) -> bool
pub fn strict_order(&self, other: &Self) -> Option<Ordering>
Sourcepub fn split_at(&mut self, position: usize, left: bool) -> Self
pub fn split_at(&mut self, position: usize, left: bool) -> Self
split self, return the split out interval.
if left is true, the left part is split out and returned.
This function does not check whether position is valid.
pub fn intersects(&self, other: Self) -> bool
pub fn intersection_uncheck(&self, other: Self) -> Self
pub fn intersection(&self, other: Self) -> Option<Self>
pub fn advance(&mut self, offset: usize)
pub fn move_back(&self, offset: usize) -> Self
Trait Implementations§
Source§impl Ord for TextRange
impl Ord for TextRange
Source§impl PartialOrd for TextRange
impl PartialOrd for TextRange
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