pub struct SourcePos { /* private fields */ }
Expand description
A specific part of input.
This is represented as start and end offsets into SourceFile
.
The sourcefile is internally reference counted, so a SourcePos
can
be cheaply cloned, but does not implement copy.
Implementations§
source§impl SourcePos
impl SourcePos
sourcepub fn show(&self, out: &mut impl Write) -> Result
pub fn show(&self, out: &mut impl Write) -> Result
Show this source position.
Dislays the line containg the position, highlighting the position. This is typically used when there is one source position relevant for an error.
sourcepub fn show_two(
out: &mut Formatter<'_>,
one: &Self,
one_name: &str,
other: &Self,
other_name: &str
) -> Result
pub fn show_two( out: &mut Formatter<'_>, one: &Self, one_name: &str, other: &Self, other_name: &str ) -> Result
Show two source positions together.
sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
True if the source of this position is built-in.
Trait Implementations§
source§impl From<SourceFile> for SourcePos
impl From<SourceFile> for SourcePos
source§fn from(source: SourceFile) -> Self
fn from(source: SourceFile) -> Self
Converts to this type from the input type.
source§impl Ord for SourcePos
impl Ord for SourcePos
source§impl PartialEq for SourcePos
impl PartialEq for SourcePos
source§impl PartialOrd for SourcePos
impl PartialOrd for SourcePos
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 Eq for SourcePos
Auto Trait Implementations§
impl Freeze for SourcePos
impl RefUnwindSafe for SourcePos
impl Send for SourcePos
impl Sync for SourcePos
impl Unpin for SourcePos
impl UnwindSafe for SourcePos
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