pub struct SigmaCollection {
pub rules: Vec<SigmaRule>,
pub correlations: Vec<CorrelationRule>,
pub filters: Vec<FilterRule>,
pub diagnostics: Vec<CollectionDiagnostic>,
}Expand description
A collection of parsed Sigma documents from one or more YAML files.
Fields§
§rules: Vec<SigmaRule>§correlations: Vec<CorrelationRule>§filters: Vec<FilterRule>§diagnostics: Vec<CollectionDiagnostic>Problems found while building the collection, in the order they
were found. An error means a
document was dropped; a warning
means a document was kept with an invalid value ignored. The
collection is returned on Ok(_) either way, so callers decide
whether a partial parse is acceptable;
SigmaCollection::has_errors and SigmaCollection::into_result
cover the common “fail on any error” path.
Implementations§
Source§impl SigmaCollection
impl SigmaCollection
pub fn new() -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn errors(&self) -> impl Iterator<Item = &CollectionDiagnostic>
pub fn errors(&self) -> impl Iterator<Item = &CollectionDiagnostic>
The error diagnostics, in order.
Sourcepub fn warnings(&self) -> impl Iterator<Item = &CollectionDiagnostic>
pub fn warnings(&self) -> impl Iterator<Item = &CollectionDiagnostic>
The warning diagnostics, in order.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
True when at least one diagnostic is an error. Warnings do not count.
Sourcepub fn error_count(&self) -> usize
pub fn error_count(&self) -> usize
Number of error diagnostics.
Sourcepub fn warning_count(&self) -> usize
pub fn warning_count(&self) -> usize
Number of warning diagnostics.
Sourcepub fn into_result(self) -> Result<Self, Vec<CollectionDiagnostic>>
pub fn into_result(self) -> Result<Self, Vec<CollectionDiagnostic>>
Promote errors to a hard failure. Returns the collection, warnings
included, when SigmaCollection::has_errors is false; otherwise
returns every diagnostic, warnings included, so callers can report
them together. The collection is consumed either way so the success
path can move out of self without re-cloning the documents.