pub struct Diagnostics {
pub diagnostics: BTreeMap<DiagnosticOrigin, Vec<Diagnostic>>,
pub config: DiagnosticsConfig,
}
Fields§
§diagnostics: BTreeMap<DiagnosticOrigin, Vec<Diagnostic>>
§config: DiagnosticsConfig
Implementations§
Source§impl Diagnostics
impl Diagnostics
pub fn new(config: DiagnosticsConfig) -> Diagnostics
pub fn add_parsing_error(&mut self, err: impl Display, source: Source)
pub fn add_book_error(&mut self, err: impl Display)
pub fn add_function_error( &mut self, err: impl Display, name: Name, source: Source, )
pub fn add_inet_error(&mut self, err: impl Display, def_name: String)
pub fn add_function_warning( &mut self, warn: impl Display, warn_type: WarningType, def_name: Name, source: Source, )
pub fn add_book_warning(&mut self, warn: impl Display, warn_type: WarningType)
pub fn add_diagnostic( &mut self, msg: impl Display, severity: Severity, orig: DiagnosticOrigin, source: Source, )
pub fn take_rule_err<T, E>(
&mut self,
result: Result<T, E>,
def_name: Name,
) -> Option<T>where
E: Display,
pub fn take_inet_err<T, E>(
&mut self,
result: Result<T, E>,
def_name: String,
) -> Option<T>where
E: Display,
pub fn has_severity(&self, severity: Severity) -> bool
pub fn has_errors(&self) -> bool
Sourcepub fn fatal<T>(&mut self, t: T) -> Result<T, Diagnostics>
pub fn fatal<T>(&mut self, t: T) -> Result<T, Diagnostics>
Checks if any error was emitted since the start of the pass,
Returning all the current information as a Err(Info)
, replacing &mut self
with an empty one.
Otherwise, returns the given arg as an Ok(T)
.
Sourcepub fn display_with_severity(&self, severity: Severity) -> impl Display
pub fn display_with_severity(&self, severity: Severity) -> impl Display
Returns a Display that prints the diagnostics with one of the given severities.
pub fn display_only_messages(&self) -> impl Display
Trait Implementations§
Source§impl Clone for Diagnostics
impl Clone for Diagnostics
Source§fn clone(&self) -> Diagnostics
fn clone(&self) -> Diagnostics
Returns a copy 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 Diagnostics
impl Debug for Diagnostics
Source§impl Default for Diagnostics
impl Default for Diagnostics
Source§fn default() -> Diagnostics
fn default() -> Diagnostics
Returns the “default value” for a type. Read more
Source§impl Display for Diagnostics
impl Display for Diagnostics
Source§impl From<ParseError> for Diagnostics
impl From<ParseError> for Diagnostics
Source§fn from(value: ParseError) -> Diagnostics
fn from(value: ParseError) -> Diagnostics
Transforms a parse error into Diagnostics
.
NOTE: Since ParseError
does not include the source code, we can’t get the TextLocation
of the error,
so it is not included in the diagnostic.
range is set as None.
Source§impl From<String> for Diagnostics
impl From<String> for Diagnostics
Source§fn from(value: String) -> Diagnostics
fn from(value: String) -> Diagnostics
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Diagnostics
impl RefUnwindSafe for Diagnostics
impl Send for Diagnostics
impl Sync for Diagnostics
impl Unpin for Diagnostics
impl UnwindSafe for Diagnostics
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more