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 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