pub struct RawSpan {
pub src_id: FileId,
pub start: ByteIndex,
pub end: ByteIndex,
}Expand description
A position span identified by a starting byte offset and an ending byte offset in a file.
end is the offset of the last character plus one.
Fields§
§src_id: FileId§start: ByteIndex§end: ByteIndexImplementations§
Source§impl RawSpan
impl RawSpan
Sourcepub fn fuse(self, other: RawSpan) -> Option<RawSpan>
pub fn fuse(self, other: RawSpan) -> Option<RawSpan>
Fuse two spans if they are from the same source file. The resulting span is the smallest
span that contain both self and other.
Sourcepub fn from_codespan(src_id: FileId, span: Span) -> Self
pub fn from_codespan(src_id: FileId, span: Span) -> Self
Create a RawSpan from a span as represented by the codespan library.
Sourcepub fn from_range<T>(src_id: FileId, range: Range<T>) -> Self
pub fn from_range<T>(src_id: FileId, range: Range<T>) -> Self
Create a span from a numeric range. If either start or end is too large to be represented,
u32::MAX is used instead.
Sourcepub fn to_range<T>(self) -> Range<T>
pub fn to_range<T>(self) -> Range<T>
Convert this span to a numeric index range. If either start or end is too large to be
represented, T::MAX is used instead.
Sourcepub fn contains_span(&self, other: RawSpan) -> bool
pub fn contains_span(&self, other: RawSpan) -> bool
Check whether this span contains another span.
Trait Implementations§
Source§impl PartialOrd for RawSpan
An inclusion ordering for spans: s1 is smaller than s2 if they are located in the same file
and s1 is included in s2 when seen as position intervals.
impl PartialOrd for RawSpan
An inclusion ordering for spans: s1 is smaller than s2 if they are located in the same file
and s1 is included in s2 when seen as position intervals.
impl Copy for RawSpan
impl Eq for RawSpan
impl StructuralPartialEq for RawSpan
Auto Trait Implementations§
impl Freeze for RawSpan
impl RefUnwindSafe for RawSpan
impl Send for RawSpan
impl Sync for RawSpan
impl Unpin for RawSpan
impl UnsafeUnpin for RawSpan
impl UnwindSafe for RawSpan
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
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
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more