pub struct TextRange {
pub start: usize,
pub end: usize,
}Expand description
A byte range within a document’s source string.
Fields§
§start: usizeInclusive start byte offset.
end: usizeExclusive end byte offset.
Implementations§
Source§impl TextRange
impl TextRange
Sourcepub fn try_new(start: usize, end: usize) -> Result<Self, RangeError>
pub fn try_new(start: usize, end: usize) -> Result<Self, RangeError>
Creates a new TextRange, validating that start <= end.
Bounds and UTF-8 boundary checks require the source string, so they
happen in DocumentChange::try_apply, not here.
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