pub struct Span<'db> {
pub anchor: Anchor<'db>,
pub start: Offset,
pub end: Offset,
}Expand description
A span within the input.
The offsets are stored relative to the start of the anchor, which is some item (e.g., a class, function, etc). The use of relative offsets avoids incremental churn if lines or content is added before/after the definition.
Fields§
§anchor: Anchor<'db>§start: Offset§end: OffsetImplementations§
Source§impl<'db> Span<'db>
impl<'db> Span<'db>
pub fn to(self, db: &'db dyn Db, end: impl IntoOptionSpan<'db>) -> Span<'db>
pub fn start_from(self, start: impl IntoOptionSpan<'db>) -> Span<'db>
Sourcepub fn absolute_span(&self, db: &'db dyn Db) -> AbsoluteSpan
pub fn absolute_span(&self, db: &'db dyn Db) -> AbsoluteSpan
Convert this span into an absolute span for reporting errors.
pub fn source_file(&self, db: &dyn Db) -> SourceFile
Trait Implementations§
Source§impl<'db> IntoOptionSpan<'db> for Span<'db>
impl<'db> IntoOptionSpan<'db> for Span<'db>
fn into_opt_span(self) -> Option<Span<'db>>
Source§impl<'db> Ord for Span<'db>
impl<'db> Ord for Span<'db>
Source§impl<'db> PartialOrd for Span<'db>
impl<'db> PartialOrd for Span<'db>
impl<'db> Copy for Span<'db>
impl<'db> Eq for Span<'db>
impl<'db> StructuralPartialEq for Span<'db>
Auto Trait Implementations§
impl<'db> Freeze for Span<'db>
impl<'db> !RefUnwindSafe for Span<'db>
impl<'db> Send for Span<'db>
impl<'db> Sync for Span<'db>
impl<'db> Unpin for Span<'db>
impl<'db> UnsafeUnpin for Span<'db>
impl<'db> !UnwindSafe for Span<'db>
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> HashEqLike<T> for T
impl<T> HashEqLike<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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