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
§Fase 28.d — 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.