pub struct Diagnostic { /* private fields */ }Expand description
A non-fatal problem found while reading a model.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new(kind: DiagnosticKind, detail: impl Into<String>) -> Self
pub fn new(kind: DiagnosticKind, detail: impl Into<String>) -> Self
Records a warning of kind with no source location; add one with the
with_* builders.
Sourcepub fn warning(byte_range: Range<usize>, detail: impl Into<String>) -> Self
pub fn warning(byte_range: Range<usize>, detail: impl Into<String>) -> Self
Records a DiagnosticKind::Other warning covering a byte range of
the source.
Sourcepub fn unlocated(detail: impl Into<String>) -> Self
pub fn unlocated(detail: impl Into<String>) -> Self
Records a DiagnosticKind::Other warning with no source location.
Sourcepub fn with_byte_range(self, range: Range<usize>) -> Self
pub fn with_byte_range(self, range: Range<usize>) -> Self
Sets the byte range of the source this finding covers.
Sourcepub fn with_position(self, position: SourcePosition) -> Self
pub fn with_position(self, position: SourcePosition) -> Self
Sets the line and column where the finding starts.
Sourcepub fn with_instance(self, id: EntityId) -> Self
pub fn with_instance(self, id: EntityId) -> Self
Sets the instance at fault: a skipped record’s id, the duplicated id or the missing id of a dangling reference.
Sourcepub fn with_referrer(self, id: EntityId) -> Self
pub fn with_referrer(self, id: EntityId) -> Self
Sets the record holding a dangling reference.
Sourcepub fn with_excerpt(self, excerpt: impl Into<String>) -> Self
pub fn with_excerpt(self, excerpt: impl Into<String>) -> Self
Sets a short quote of the source this finding covers.
Sourcepub const fn kind(&self) -> DiagnosticKind
pub const fn kind(&self) -> DiagnosticKind
What this finding is about.
Sourcepub const fn byte_range(&self) -> Option<&Range<usize>>
pub const fn byte_range(&self) -> Option<&Range<usize>>
Byte range of the source this finding covers, when the codec has one.
Sourcepub const fn instance(&self) -> Option<EntityId>
pub const fn instance(&self) -> Option<EntityId>
The instance at fault: a skipped record’s id when it was read, the
duplicated id, or the missing id of a dangling reference. None for
DiagnosticKind::RealWithoutPoint and DiagnosticKind::Other.
Sourcepub const fn referrer(&self) -> Option<EntityId>
pub const fn referrer(&self) -> Option<EntityId>
The record holding the reference, for a
DiagnosticKind::DanglingReference only.
Sourcepub const fn position(&self) -> Option<SourcePosition>
pub const fn position(&self) -> Option<SourcePosition>
Line and column where the finding starts, when the codec has one.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more