#[non_exhaustive]pub struct Diagnostic {
pub severity: Severity,
pub code: &'static str,
pub message: String,
pub path: DocPath,
pub span: Option<SourceSpan>,
pub node: Option<String>,
pub suggestion: Option<String>,
pub help: Option<String>,
pub at_key: bool,
}Expand description
One validation finding.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.severity: Severity§code: &'static strStable machine-readable category, e.g. unknown-field, unknown-node.
message: String§path: DocPathWhere in the document, e.g. graph.nodes[1].template.
span: Option<SourceSpan>Source position (line, column, length), when known.
node: Option<String>Id of the node the finding is about.
suggestion: Option<String>Likely intended spelling (“did you mean template?”).
help: Option<String>Extra guidance.
at_key: boolPoint at the key of path rather than its value.
Implementations§
Source§impl Diagnostic
impl Diagnostic
pub fn error( code: &'static str, path: DocPath, message: impl Into<String>, ) -> Self
pub fn warning( code: &'static str, path: DocPath, message: impl Into<String>, ) -> Self
pub fn with_suggestion(self, suggestion: Option<String>) -> Self
pub fn with_help(self, help: impl Into<String>) -> Self
pub fn with_node(self, id: &str) -> Self
pub fn is_error(&self) -> bool
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl Display for Diagnostic
impl Display for Diagnostic
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§impl Serialize for Diagnostic
impl Serialize for Diagnostic
impl StructuralPartialEq for Diagnostic
Auto Trait Implementations§
impl Forget for Diagnostic
impl Freeze for Diagnostic
impl Move for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnostic
impl UnwindSafe for Diagnostic
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