pub struct SourceSnippet {
pub source: String,
pub line: u32,
pub column: u32,
pub filename: String,
pub context_before: usize,
pub context_after: usize,
}Expand description
v1.20.0 — Rustc-style source-context block for a parse error.
Holds a reference to the source text plus the line/column the
error points at. Rendering is lazy — call render() to format
the block (line numbers + caret + 2 lines before + 2 after).
Pure and deterministic: no ANSI colors, no terminal-width
detection. Output shape is byte-identical to the Python
SourceSnippet.render() on the same input — that’s the cross-
stack drift gate (28.i).
Fields§
§source: String§line: u32§column: u32§filename: String§context_before: usize§context_after: usizeImplementations§
Source§impl SourceSnippet
impl SourceSnippet
Trait Implementations§
Source§impl Clone for SourceSnippet
impl Clone for SourceSnippet
Source§fn clone(&self) -> SourceSnippet
fn clone(&self) -> SourceSnippet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SourceSnippet
impl RefUnwindSafe for SourceSnippet
impl Send for SourceSnippet
impl Sync for SourceSnippet
impl Unpin for SourceSnippet
impl UnsafeUnpin for SourceSnippet
impl UnwindSafe for SourceSnippet
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