pub struct InlineError {
pub message: String,
pub span: Option<(usize, usize)>,
pub annotations: Vec<DiagnosticAnnotation>,
pub notes: Vec<String>,
pub helps: Vec<String>,
}Expand description
User-facing diagnostic collected during parsing.
Fields§
§message: StringPrimary message for the diagnostic.
span: Option<(usize, usize)>Primary span, if the diagnostic has one.
annotations: Vec<DiagnosticAnnotation>Additional annotated spans.
notes: Vec<String>Explanatory notes.
helps: Vec<String>Suggested fixes or next steps.
Implementations§
Source§impl InlineError
impl InlineError
Sourcepub fn new(message: impl Into<String>) -> Self
pub fn new(message: impl Into<String>) -> Self
Create a new diagnostic with message and no span.
Sourcepub fn at(span: (usize, usize), message: impl Into<String>) -> Self
pub fn at(span: (usize, usize), message: impl Into<String>) -> Self
Create a new diagnostic anchored at span.
Sourcepub fn reporting_span(&self) -> (usize, usize)
pub fn reporting_span(&self) -> (usize, usize)
Span used when reporting (falls back to (0, 0) if unset).
Sourcepub fn with_span(self, span: Option<(usize, usize)>) -> Self
pub fn with_span(self, span: Option<(usize, usize)>) -> Self
Return a copy of this diagnostic with span replaced.
Sourcepub fn set_span(&mut self, span: Option<(usize, usize)>) -> &mut Self
pub fn set_span(&mut self, span: Option<(usize, usize)>) -> &mut Self
Replace the primary span in place.
Sourcepub fn with_note(self, note: impl Into<String>) -> Self
pub fn with_note(self, note: impl Into<String>) -> Self
Return a copy of this diagnostic with an additional note.
Sourcepub fn with_help(self, help: impl Into<String>) -> Self
pub fn with_help(self, help: impl Into<String>) -> Self
Return a copy of this diagnostic with an additional help message.
Sourcepub fn with_annotation(
self,
span: (usize, usize),
message: impl Into<String>,
kind: AnnotationKind,
) -> Self
pub fn with_annotation( self, span: (usize, usize), message: impl Into<String>, kind: AnnotationKind, ) -> Self
Return a copy of this diagnostic with an additional annotation.
Sourcepub fn add_annotation(
&mut self,
span: (usize, usize),
message: impl Into<String>,
kind: AnnotationKind,
) -> &mut Self
pub fn add_annotation( &mut self, span: (usize, usize), message: impl Into<String>, kind: AnnotationKind, ) -> &mut Self
Add an annotation in place.
Trait Implementations§
Source§impl Clone for InlineError
impl Clone for InlineError
Source§fn clone(&self) -> InlineError
fn clone(&self) -> InlineError
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 moreSource§impl Debug for InlineError
impl Debug for InlineError
Source§impl Display for InlineError
impl Display for InlineError
Source§impl From<InlineError> for ParserError
impl From<InlineError> for ParserError
Source§fn from(value: InlineError) -> Self
fn from(value: InlineError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for InlineError
impl RefUnwindSafe for InlineError
impl Send for InlineError
impl Sync for InlineError
impl Unpin for InlineError
impl UnsafeUnpin for InlineError
impl UnwindSafe for InlineError
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