pub struct SourceRange { /* private fields */ }Expand description
A half-open byte range within one source document.
Ranges are created by SourceDocument::range and
SourceDocument::empty_range, which ensure that their endpoints are
ordered and within the source bytes.
Implementations§
Source§impl SourceRange
impl SourceRange
Sourcepub const fn start(self) -> ByteOffset
pub const fn start(self) -> ByteOffset
Return the inclusive start offset.
Sourcepub const fn end(self) -> ByteOffset
pub const fn end(self) -> ByteOffset
Return the exclusive end offset.
Sourcepub fn byte_range(self) -> Range<usize> ⓘ
pub fn byte_range(self) -> Range<usize> ⓘ
Return this range as byte indices suitable for slicing.
Sourcepub fn cover(first: Self, last: Self) -> Result<Self, SourceRangeError>
pub fn cover(first: Self, last: Self) -> Result<Self, SourceRangeError>
Return the smallest range covering both ranges.
Both ranges must identify the same source document.
Trait Implementations§
Source§impl Clone for SourceRange
impl Clone for SourceRange
Source§fn clone(&self) -> SourceRange
fn clone(&self) -> SourceRange
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SourceRange
Source§impl Debug for SourceRange
impl Debug for SourceRange
impl Eq for SourceRange
Source§impl Hash for SourceRange
impl Hash for SourceRange
Source§impl PartialEq for SourceRange
impl PartialEq for SourceRange
impl StructuralPartialEq for SourceRange
Auto Trait Implementations§
impl Freeze for SourceRange
impl RefUnwindSafe for SourceRange
impl Send for SourceRange
impl Sync for SourceRange
impl Unpin for SourceRange
impl UnsafeUnpin for SourceRange
impl UnwindSafe for SourceRange
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.