pub struct Snippet<'a> {
pub line_no: u32,
pub col_start: u32,
pub col_end: u32,
pub line_text: &'a str,
}Expand description
Source-snippet view shared by the pretty and JSON renderers: the one line of source covering a diagnostic’s span, plus the column range of the underlined region.
For multi-line spans the underlined region is clamped to the first line — both renderers point at the start of the offence.
Fields§
§line_no: u321-indexed line number.
col_start: u321-indexed codepoint column of the span’s first character.
col_end: u321-indexed codepoint column one past the span’s last character
on this line (so col_end - col_start codepoints are
underlined). Always ≥ col_start + 1 so the caret is visible.
line_text: &'a strThe line text, without the trailing \n.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Snippet<'a>
impl<'a> RefUnwindSafe for Snippet<'a>
impl<'a> Send for Snippet<'a>
impl<'a> Sync for Snippet<'a>
impl<'a> Unpin for Snippet<'a>
impl<'a> UnsafeUnpin for Snippet<'a>
impl<'a> UnwindSafe for Snippet<'a>
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