pub struct SourceContext {
pub lines: Vec<SourceLine>,
pub error_line_index: usize,
}Expand description
Source context for rendering
Fields§
§lines: Vec<SourceLine>Lines around the error (typically 1-3 lines before, error line, 1-3 after)
error_line_index: usizeIndex of the error line in the lines vector
Implementations§
Source§impl SourceContext
impl SourceContext
pub fn new(lines: Vec<SourceLine>, error_line_index: usize) -> Self
Sourcepub fn from_source(
source: &str,
location: &SourceLocation,
span_end: Option<(usize, usize)>,
) -> Self
pub fn from_source( source: &str, location: &SourceLocation, span_end: Option<(usize, usize)>, ) -> Self
Build source context from source text and location
Trait Implementations§
Source§impl Clone for SourceContext
impl Clone for SourceContext
Source§fn clone(&self) -> SourceContext
fn clone(&self) -> SourceContext
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 SourceContext
impl Debug for SourceContext
Source§impl Default for SourceContext
impl Default for SourceContext
Source§fn default() -> SourceContext
fn default() -> SourceContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SourceContext
impl RefUnwindSafe for SourceContext
impl Send for SourceContext
impl Sync for SourceContext
impl Unpin for SourceContext
impl UnsafeUnpin for SourceContext
impl UnwindSafe for SourceContext
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