pub struct ErrorContext {
pub line_content: String,
pub column_position: usize,
pub suggestion: Option<String>,
pub surrounding_lines: Vec<(usize, String)>,
}
Expand description
Context information for error reporting
Fields§
§line_content: String
The problematic line content
column_position: usize
Position within the line where the error occurred
suggestion: Option<String>
Optional suggestion for fixing the error
surrounding_lines: Vec<(usize, String)>
Additional context lines (before and after)
Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub const fn new(line_content: String, column_position: usize) -> Self
pub const fn new(line_content: String, column_position: usize) -> Self
Create a new error context
Sourcepub fn with_suggestion(self, suggestion: String) -> Self
pub fn with_suggestion(self, suggestion: String) -> Self
Add a suggestion for fixing the error
Sourcepub fn with_surrounding_lines(self, lines: Vec<(usize, String)>) -> Self
pub fn with_surrounding_lines(self, lines: Vec<(usize, String)>) -> Self
Add surrounding lines for context
Sourcepub fn from_input(
input: &str,
position: &Position,
context_lines: usize,
) -> Self
pub fn from_input( input: &str, position: &Position, context_lines: usize, ) -> Self
Create error context from input text and position
Trait Implementations§
Source§impl Clone for ErrorContext
impl Clone for ErrorContext
Source§fn clone(&self) -> ErrorContext
fn clone(&self) -> ErrorContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ErrorContext
impl Debug for ErrorContext
Source§impl PartialEq for ErrorContext
impl PartialEq for ErrorContext
impl Eq for ErrorContext
impl StructuralPartialEq for ErrorContext
Auto Trait Implementations§
impl Freeze for ErrorContext
impl RefUnwindSafe for ErrorContext
impl Send for ErrorContext
impl Sync for ErrorContext
impl Unpin for ErrorContext
impl UnwindSafe for ErrorContext
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.