[−][src]Struct syntex_syntax2::diagnostics::plugin::diagnostic_builder::DiagnosticBuilder
Used for emitting structured error messages and other diagnostic information.
Methods
impl<'a> DiagnosticBuilder<'a>
[src]
pub fn emit(&mut self)
[src]
Emit the diagnostic.
pub fn span_label<T>(
&mut self,
span: Span,
label: T
) -> &mut DiagnosticBuilder<'a> where
T: Into<String>,
[src]
&mut self,
span: Span,
label: T
) -> &mut DiagnosticBuilder<'a> where
T: Into<String>,
Add a span/label to be included in the resulting snippet.
This is pushed onto the MultiSpan
that was created when the
diagnostic was first built. If you don't call this function at
all, and you just supplied a Span
to create the diagnostic,
then the snippet will just include that Span
, which is
called the primary span.
pub fn note_expected_found(
&mut self,
label: &dyn Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString
) -> &mut DiagnosticBuilder<'a>
[src]
&mut self,
label: &dyn Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString
) -> &mut DiagnosticBuilder<'a>
pub fn note_expected_found_extra(
&mut self,
label: &dyn Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
expected_extra: &dyn Display,
found_extra: &dyn Display
) -> &mut DiagnosticBuilder<'a>
[src]
&mut self,
label: &dyn Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
expected_extra: &dyn Display,
found_extra: &dyn Display
) -> &mut DiagnosticBuilder<'a>
pub fn note(&mut self, msg: &str) -> &mut DiagnosticBuilder<'a>
[src]
pub fn span_note<S>(&mut self, sp: S, msg: &str) -> &mut DiagnosticBuilder<'a> where
S: Into<MultiSpan>,
[src]
S: Into<MultiSpan>,
pub fn warn(&mut self, msg: &str) -> &mut DiagnosticBuilder<'a>
[src]
pub fn span_warn<S>(&mut self, sp: S, msg: &str) -> &mut DiagnosticBuilder<'a> where
S: Into<MultiSpan>,
[src]
S: Into<MultiSpan>,
pub fn help(&mut self, msg: &str) -> &mut DiagnosticBuilder<'a>
[src]
pub fn span_help<S>(&mut self, sp: S, msg: &str) -> &mut DiagnosticBuilder<'a> where
S: Into<MultiSpan>,
[src]
S: Into<MultiSpan>,
pub fn span_suggestion(
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut DiagnosticBuilder<'a>
[src]
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut DiagnosticBuilder<'a>
pub fn span_suggestions(
&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>
) -> &mut DiagnosticBuilder<'a>
[src]
&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>
) -> &mut DiagnosticBuilder<'a>
pub fn set_span<S>(&mut self, sp: S) -> &mut DiagnosticBuilder<'a> where
S: Into<MultiSpan>,
[src]
S: Into<MultiSpan>,
pub fn code(&mut self, s: String) -> &mut DiagnosticBuilder<'a>
[src]
pub fn new(
handler: &'a Handler,
level: Level,
message: &str
) -> DiagnosticBuilder<'a>
[src]
handler: &'a Handler,
level: Level,
message: &str
) -> DiagnosticBuilder<'a>
Convenience function for internal use, clients should use one of the struct_* methods on Handler.
pub fn new_with_code(
handler: &'a Handler,
level: Level,
code: Option<String>,
message: &str
) -> DiagnosticBuilder<'a>
[src]
handler: &'a Handler,
level: Level,
code: Option<String>,
message: &str
) -> DiagnosticBuilder<'a>
Convenience function for internal use, clients should use one of the struct_* methods on Handler.
pub fn into_diagnostic(self) -> Diagnostic
[src]
Methods from Deref<Target = Diagnostic>
pub fn cancel(&mut self)
[src]
Cancel the diagnostic (a structured diagnostic must either be emitted or
cancelled or it will panic when dropped).
BEWARE: if this DiagnosticBuilder is an error, then creating it will
bump the error count on the Handler and cancelling it won't undo that.
If you want to decrement the error count you should use Handler::cancel
.
pub fn cancelled(&self) -> bool
[src]
pub fn is_fatal(&self) -> bool
[src]
pub fn span_label<T>(&mut self, span: Span, label: T) -> &mut Diagnostic where
T: Into<String>,
[src]
T: Into<String>,
Add a span/label to be included in the resulting snippet.
This is pushed onto the MultiSpan
that was created when the
diagnostic was first built. If you don't call this function at
all, and you just supplied a Span
to create the diagnostic,
then the snippet will just include that Span
, which is
called the primary span.
pub fn note_expected_found(
&mut self,
label: &dyn Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString
) -> &mut Diagnostic
[src]
&mut self,
label: &dyn Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString
) -> &mut Diagnostic
pub fn note_expected_found_extra(
&mut self,
label: &dyn Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
expected_extra: &dyn Display,
found_extra: &dyn Display
) -> &mut Diagnostic
[src]
&mut self,
label: &dyn Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
expected_extra: &dyn Display,
found_extra: &dyn Display
) -> &mut Diagnostic
pub fn note(&mut self, msg: &str) -> &mut Diagnostic
[src]
pub fn highlighted_note(&mut self, msg: Vec<(String, Style)>) -> &mut Diagnostic
[src]
pub fn span_note<S>(&mut self, sp: S, msg: &str) -> &mut Diagnostic where
S: Into<MultiSpan>,
[src]
S: Into<MultiSpan>,
pub fn warn(&mut self, msg: &str) -> &mut Diagnostic
[src]
pub fn span_warn<S>(&mut self, sp: S, msg: &str) -> &mut Diagnostic where
S: Into<MultiSpan>,
[src]
S: Into<MultiSpan>,
pub fn help(&mut self, msg: &str) -> &mut Diagnostic
[src]
pub fn span_help<S>(&mut self, sp: S, msg: &str) -> &mut Diagnostic where
S: Into<MultiSpan>,
[src]
S: Into<MultiSpan>,
pub fn span_suggestion(
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut Diagnostic
[src]
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut Diagnostic
Prints out a message with a suggested edit of the code.
See diagnostic::CodeSuggestion
for more information.
pub fn span_suggestions(
&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>
) -> &mut Diagnostic
[src]
&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>
) -> &mut Diagnostic
pub fn set_span<S>(&mut self, sp: S) -> &mut Diagnostic where
S: Into<MultiSpan>,
[src]
S: Into<MultiSpan>,
pub fn code(&mut self, s: String) -> &mut Diagnostic
[src]
pub fn message(&self) -> String
[src]
pub fn styled_message(&self) -> &Vec<(String, Style)>
[src]
pub fn level(&self) -> Level
[src]
pub fn copy_details_not_message(&mut self, from: &Diagnostic)
[src]
Used by a lint. Copies over all details but the "main message".
Trait Implementations
impl<'a> Drop for DiagnosticBuilder<'a>
[src]
Destructor bomb - a DiagnosticBuilder
must be either emitted or cancelled
or we emit a bug.
impl<'a> Clone for DiagnosticBuilder<'a>
[src]
fn clone(&self) -> DiagnosticBuilder<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for DiagnosticBuilder<'a>
[src]
impl<'a> DerefMut for DiagnosticBuilder<'a>
[src]
fn deref_mut(&mut self) -> &mut Diagnostic
[src]
impl<'a> Deref for DiagnosticBuilder<'a>
[src]
Auto Trait Implementations
impl<'a> !Sync for DiagnosticBuilder<'a>
impl<'a> !Send for DiagnosticBuilder<'a>
impl<'a> Unpin for DiagnosticBuilder<'a>
impl<'a> !RefUnwindSafe for DiagnosticBuilder<'a>
impl<'a> !UnwindSafe for DiagnosticBuilder<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,