pub struct TextRange {
pub start: u32,
pub end: u32,
}Expand description
Represents a range in the source text identified by byte offsets.
Fields§
§start: u32§end: u32Implementations§
Source§impl TextRange
impl TextRange
pub fn new(start: u32, end: u32) -> Self
Sourcepub fn overlaps(&self, other: &TextRange) -> bool
pub fn overlaps(&self, other: &TextRange) -> bool
Checks if this range overlaps with another.
We consider touching ranges as overlapping (e.g. 0..5 and 5..10 overlap at 5).
This strictness is required to prevent ambiguity in insertion order (e.g. which
insertion happens first at offset 5?).
Zero-length ranges (insertions) at the boundary of another range are also
considered overlapping (e.g. insert at 5 overlaps with 5..10).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TextRange
impl<'de> Deserialize<'de> for TextRange
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 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 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