pub struct SourceLocation {
pub filename: String,
pub line: Option<usize>,
pub column: Option<usize>,
pub end_line: Option<usize>,
pub end_column: Option<usize>,
}
Expand description
Location information for error reporting
Fields§
§filename: String
§line: Option<usize>
§column: Option<usize>
§end_line: Option<usize>
§end_column: Option<usize>
Implementations§
Source§impl SourceLocation
impl SourceLocation
pub fn new(filename: impl Into<String>) -> Self
pub fn with_position( filename: impl Into<String>, line: Option<usize>, column: Option<usize>, ) -> Self
pub fn with_span( filename: impl Into<String>, line: Option<usize>, column: Option<usize>, end_line: Option<usize>, end_column: Option<usize>, ) -> Self
Sourcepub fn from_node(filename: impl Into<String>, node: &dyn PositionInfo) -> Self
pub fn from_node(filename: impl Into<String>, node: &dyn PositionInfo) -> Self
Create a SourceLocation from an AST node that implements PositionInfo
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 Display for SourceLocation
impl Display for SourceLocation
Source§impl PartialEq for SourceLocation
impl PartialEq 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ErrorContext for Twhere
T: Debug,
impl<T> ErrorContext for Twhere
T: Debug,
Source§fn with_context(&self, operation: &str) -> String
fn with_context(&self, operation: &str) -> String
Generate a standardized error message with context.