#[non_exhaustive]pub struct CollectionDiagnostic {
pub kind: DiagnosticKind,
pub severity: DiagnosticSeverity,
pub message: String,
pub document: Option<usize>,
pub path: Option<PathBuf>,
pub location: Option<SourceLocation>,
}Expand description
A problem found while building a SigmaCollection.
Display prints message.
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.kind: DiagnosticKind§severity: DiagnosticSeverity§message: String§document: Option<usize>Zero-based index of the YAML document within its file or string.
path: Option<PathBuf>The file the problem was found in, when the collection was read from disk.
location: Option<SourceLocation>Position within the document, for YAML syntax and condition errors.
Implementations§
Source§impl CollectionDiagnostic
impl CollectionDiagnostic
Sourcepub fn error(kind: DiagnosticKind, message: impl Into<String>) -> Self
pub fn error(kind: DiagnosticKind, message: impl Into<String>) -> Self
An error diagnostic.
Sourcepub fn warning(kind: DiagnosticKind, message: impl Into<String>) -> Self
pub fn warning(kind: DiagnosticKind, message: impl Into<String>) -> Self
A warning diagnostic.
Sourcepub fn document(error: &SigmaParserError) -> Self
pub fn document(error: &SigmaParserError) -> Self
An error for a document the parser rejected.
Sourcepub fn file(path: &Path, error: &SigmaParserError) -> Self
pub fn file(path: &Path, error: &SigmaParserError) -> Self
An error for a file that could not be read or parsed at all.
Sourcepub fn with_document(self, index: usize) -> Self
pub fn with_document(self, index: usize) -> Self
Set the zero-based index of the YAML document.
Sourcepub fn with_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_path(self, path: impl Into<PathBuf>) -> Self
Set the file the problem was found in.
Sourcepub fn with_location(self, location: Option<SourceLocation>) -> Self
pub fn with_location(self, location: Option<SourceLocation>) -> Self
Set the position within the document.
Sourcepub fn is_error(&self) -> bool
pub fn is_error(&self) -> bool
True for DiagnosticSeverity::Error.
Trait Implementations§
Source§impl Clone for CollectionDiagnostic
impl Clone for CollectionDiagnostic
Source§impl Debug for CollectionDiagnostic
impl Debug for CollectionDiagnostic
Source§impl Display for CollectionDiagnostic
impl Display for CollectionDiagnostic
impl Eq for CollectionDiagnostic
Source§impl PartialEq for CollectionDiagnostic
impl PartialEq for CollectionDiagnostic
Source§impl Serialize for CollectionDiagnostic
impl Serialize for CollectionDiagnostic
impl StructuralPartialEq for CollectionDiagnostic
Auto Trait Implementations§
impl Freeze for CollectionDiagnostic
impl RefUnwindSafe for CollectionDiagnostic
impl Send for CollectionDiagnostic
impl Sync for CollectionDiagnostic
impl Unpin for CollectionDiagnostic
impl UnsafeUnpin for CollectionDiagnostic
impl UnwindSafe for CollectionDiagnostic
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<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
Compare self to
key and return true if they are equal.