pub struct SourceLocation {
pub file: Option<String>,
pub line: usize,
pub column: usize,
pub length: Option<usize>,
pub source_line: Option<String>,
pub hints: Vec<String>,
pub notes: Vec<ErrorNote>,
pub is_synthetic: bool,
}Expand description
Source location information for error reporting
Fields§
§file: Option<String>§line: usize§column: usize§length: Option<usize>§source_line: Option<String>§hints: Vec<String>§notes: Vec<ErrorNote>§is_synthetic: boolImplementations§
Source§impl SourceLocation
impl SourceLocation
Sourcepub fn with_hint(self, hint: impl Into<String>) -> Self
pub fn with_hint(self, hint: impl Into<String>) -> Self
Add a hint/suggestion (e.g., “did you mean foo?”)
Sourcepub fn with_hints(
self,
hints: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_hints( self, hints: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Add multiple hints
Sourcepub fn with_note(self, note: ErrorNote) -> Self
pub fn with_note(self, note: ErrorNote) -> Self
Add a note showing related location (e.g., “first defined here:”)
Sourcepub fn with_notes(self, notes: impl IntoIterator<Item = ErrorNote>) -> Self
pub fn with_notes(self, notes: impl IntoIterator<Item = ErrorNote>) -> Self
Add multiple notes
Trait Implementations§
Source§impl Clone for SourceLocation
impl Clone for SourceLocation
Source§fn clone(&self) -> SourceLocation
fn clone(&self) -> SourceLocation
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 SourceLocation
impl Debug for SourceLocation
Source§impl<'de> Deserialize<'de> for SourceLocation
impl<'de> Deserialize<'de> for SourceLocation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SourceLocation
impl PartialEq for SourceLocation
Source§impl Serialize for SourceLocation
impl Serialize for SourceLocation
impl StructuralPartialEq for SourceLocation
Auto Trait Implementations§
impl Freeze for SourceLocation
impl RefUnwindSafe for SourceLocation
impl Send for SourceLocation
impl Sync for SourceLocation
impl Unpin for SourceLocation
impl UnsafeUnpin for SourceLocation
impl UnwindSafe for SourceLocation
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