pub struct Span { /* private fields */ }
Expand description
A source code location.
Essentially a lo..hi
range into a SourceMap
file’s source code.
Both lo
and hi
are offset by the file’s starting position.
Implementations§
Source§impl Span
impl Span
Sourcepub fn with_lo(self, lo: BytePos) -> Self
pub fn with_lo(self, lo: BytePos) -> Self
Creates a new span with the same hi position as this span and the given lo position.
Sourcepub fn with_hi(self, hi: BytePos) -> Self
pub fn with_hi(self, hi: BytePos) -> Self
Creates a new span with the same lo position as this span and the given hi position.
Sourcepub fn shrink_to_lo(self) -> Self
pub fn shrink_to_lo(self) -> Self
Creates a new span representing an empty span at the beginning of this span.
Sourcepub fn shrink_to_hi(self) -> Self
pub fn shrink_to_hi(self) -> Self
Creates a new span representing an empty span at the end of this span.
Sourcepub fn split_at(self, pos: u32) -> (Self, Self)
pub fn split_at(self, pos: u32) -> (Self, Self)
Splits a span into two composite spans around a certain position.
Sourcepub fn to(self, end: Self) -> Self
pub fn to(self, end: Self) -> Self
Returns a Span
that would enclose both self
and end
.
Note that this can also be used to extend the span “backwards”:
start.to(end)
and end.to(start)
return the same Span
.
____ ___
self lorem ipsum end
^^^^^^^^^^^^^^^^^^^^
Trait Implementations§
Source§impl Ord for Span
impl Ord for Span
Source§impl PartialOrd for Span
impl PartialOrd for Span
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.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
Compares
self
to key
and returns true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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