pub struct Span { /* private fields */ }Expand description
A position in the original source stream, used to render errors.
Implementations§
source§impl Span
impl Span
sourcepub fn from_offset(offset: usize) -> Self
pub fn from_offset(offset: usize) -> Self
Construct a Span from a byte offset in the source file.
sourcepub fn linecol_in(&self, text: &str) -> (usize, usize)
pub fn linecol_in(&self, text: &str) -> (usize, usize)
Returns the line/column information of this span within text.
Line and column numbers are 0-indexed. User presentation is typically
1-indexed, but 0-indexing is appropriate for internal use with
iterators and slices.
Trait Implementations§
source§impl Ord for Span
impl Ord for Span
source§impl PartialEq for Span
impl PartialEq for Span
source§impl PartialOrd for Span
impl PartialOrd for Span
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for Span
impl Eq for Span
impl StructuralEq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
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