pub struct Scope { /* private fields */ }Expand description
Scope filter applied per result before Enricher::enrich.
Constructed once at config load and then read concurrently from the
pipeline driver, so all internal state is immutable after Scope::new.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn new(
rules: Vec<String>,
tags: Vec<String>,
levels: Vec<String>,
) -> Result<Self, String>
pub fn new( rules: Vec<String>, tags: Vec<String>, levels: Vec<String>, ) -> Result<Self, String>
Build a scope from raw config values.
rules mixes exact rule IDs (anything without glob metacharacters)
and rule-title globs (anything containing *, ?, or [).
tags mixes exact tags and prefix-wildcard patterns ending in
.* (e.g. attack.*). levels is a list of severity strings as
understood by [Level::from_str].
Returns an error if any glob fails to compile or any level string fails to parse, so the daemon refuses to start with a malformed scope rather than silently mismatching at runtime.
Sourcepub fn is_unrestricted(&self) -> bool
pub fn is_unrestricted(&self) -> bool
True when no axis is populated. The pipeline can fast-path past empty scopes without inspecting the result.
Sourcepub fn matches(&self, result: &EvaluationResult) -> bool
pub fn matches(&self, result: &EvaluationResult) -> bool
True when this scope admits the given result.
Each populated axis must match; empty axes are skipped. An
unrestricted scope (Scope::is_unrestricted) admits every result.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
impl UnwindSafe for Scope
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§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
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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