pub struct DiagLoc {
pub span: Span,
pub file: Option<FileLocRange>,
}Expand description
Where in the source a diagnostic points. Carrying both the byte
Span (set by every parser arm) and the optional FileLocRange
projection (populated when the parser is configured to track line/col)
keeps low-level tooling and human-facing renderers happy without a
second walk over the source buffer.
Fields§
§span: Span§file: Option<FileLocRange>Implementations§
Source§impl DiagLoc
impl DiagLoc
Sourcepub const fn span(span: Span) -> Self
pub const fn span(span: Span) -> Self
Construct a diagnostic location pinned to a byte span only.
Sourcepub const fn with_file(self, file: FileLocRange) -> Self
pub const fn with_file(self, file: FileLocRange) -> Self
Attach a FileLocRange projection to an existing diagnostic.
Trait Implementations§
impl Copy for DiagLoc
impl Eq for DiagLoc
impl StructuralPartialEq for DiagLoc
Auto Trait Implementations§
impl Freeze for DiagLoc
impl RefUnwindSafe for DiagLoc
impl Send for DiagLoc
impl Sync for DiagLoc
impl Unpin for DiagLoc
impl UnsafeUnpin for DiagLoc
impl UnwindSafe for DiagLoc
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