pub struct DiagnosticBag {
pub diagnostics: Vec<Diagnostic>,
}Expand description
Collects independent diagnostics from a single compilation pass.
Fields§
§diagnostics: Vec<Diagnostic>Implementations§
Source§impl DiagnosticBag
impl DiagnosticBag
Sourcepub fn info(
&mut self,
code: impl Into<String>,
path: impl Into<String>,
message: impl Into<String>,
) -> &mut Diagnostic
pub fn info( &mut self, code: impl Into<String>, path: impl Into<String>, message: impl Into<String>, ) -> &mut Diagnostic
Records an informational diagnostic. Informational diagnostics never block generation and are not promoted by strict mode.
Sourcepub fn advisory(
&mut self,
code: impl Into<String>,
path: impl Into<String>,
message: impl Into<String>,
) -> &mut Diagnostic
pub fn advisory( &mut self, code: impl Into<String>, path: impl Into<String>, message: impl Into<String>, ) -> &mut Diagnostic
Records an advisory diagnostic. Advisories are non-fatal safety notices that remain visible even when ordinary reporting is quiet.
Sourcepub fn error(
&mut self,
code: impl Into<String>,
path: impl Into<String>,
message: impl Into<String>,
) -> &mut Diagnostic
pub fn error( &mut self, code: impl Into<String>, path: impl Into<String>, message: impl Into<String>, ) -> &mut Diagnostic
Records an error-severity diagnostic and returns it for further
customization (e.g. setting help or related).
Sourcepub fn warning(
&mut self,
code: impl Into<String>,
path: impl Into<String>,
message: impl Into<String>,
) -> &mut Diagnostic
pub fn warning( &mut self, code: impl Into<String>, path: impl Into<String>, message: impl Into<String>, ) -> &mut Diagnostic
Records a warning-severity diagnostic and returns it for further
customization (e.g. setting help or related).
Sourcepub fn errors(&self) -> impl Iterator<Item = &Diagnostic>
pub fn errors(&self) -> impl Iterator<Item = &Diagnostic>
Iterates over error-severity diagnostics only.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
True if any error-severity diagnostic has been recorded. Warnings alone do not count.
Sourcepub fn has_code(&self, code: &str) -> bool
pub fn has_code(&self, code: &str) -> bool
True if any diagnostic (of any severity) carries code.
Sourcepub fn into_result<T>(self, value: T) -> Result<T, DiagnosticBag>
pub fn into_result<T>(self, value: T) -> Result<T, DiagnosticBag>
Converts the bag into a Result: Ok(value) if no error-severity
diagnostic was recorded, otherwise Err(self) with all diagnostics
(including warnings) intact for reporting.
Trait Implementations§
Source§impl Clone for DiagnosticBag
impl Clone for DiagnosticBag
Source§fn clone(&self) -> DiagnosticBag
fn clone(&self) -> DiagnosticBag
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiagnosticBag
impl Debug for DiagnosticBag
Source§impl Default for DiagnosticBag
impl Default for DiagnosticBag
Source§fn default() -> DiagnosticBag
fn default() -> DiagnosticBag
Source§impl<'de> Deserialize<'de> for DiagnosticBag
impl<'de> Deserialize<'de> for DiagnosticBag
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>,
Source§impl Display for DiagnosticBag
impl Display for DiagnosticBag
impl Eq for DiagnosticBag
Source§impl Error for DiagnosticBag
impl Error for DiagnosticBag
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for DiagnosticBag
impl PartialEq for DiagnosticBag
Source§impl Serialize for DiagnosticBag
impl Serialize for DiagnosticBag
impl StructuralPartialEq for DiagnosticBag
Auto Trait Implementations§
impl Freeze for DiagnosticBag
impl RefUnwindSafe for DiagnosticBag
impl Send for DiagnosticBag
impl Sync for DiagnosticBag
impl Unpin for DiagnosticBag
impl UnsafeUnpin for DiagnosticBag
impl UnwindSafe for DiagnosticBag
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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