pub struct CoOccurrencePattern {
pub name: String,
pub description: String,
pub primary: AnomalyType,
pub correlated: Vec<CorrelatedAnomaly>,
pub enabled: bool,
}Expand description
A co-occurrence pattern defining which anomalies tend to appear together.
Fields§
§name: StringName of the pattern.
description: StringDescription of when this pattern applies.
primary: AnomalyTypeThe primary/triggering anomaly type.
Correlated anomalies that may occur with the primary.
enabled: boolWhether this pattern is currently active.
Implementations§
Source§impl CoOccurrencePattern
impl CoOccurrencePattern
Sourcepub fn new(name: impl Into<String>, primary: AnomalyType) -> Self
pub fn new(name: impl Into<String>, primary: AnomalyType) -> Self
Creates a new co-occurrence pattern.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets the description.
Adds a correlated anomaly.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Sets whether the pattern is enabled.
Sourcepub fn matches(&self, anomaly_type: &AnomalyType) -> bool
pub fn matches(&self, anomaly_type: &AnomalyType) -> bool
Checks if this pattern matches a given anomaly type.
Sourcepub fn get_triggered_correlations<R: Rng>(
&self,
rng: &mut R,
) -> Vec<&CorrelatedAnomaly>
pub fn get_triggered_correlations<R: Rng>( &self, rng: &mut R, ) -> Vec<&CorrelatedAnomaly>
Gets correlated anomalies that should be triggered.
Trait Implementations§
Source§impl Clone for CoOccurrencePattern
impl Clone for CoOccurrencePattern
Source§fn clone(&self) -> CoOccurrencePattern
fn clone(&self) -> CoOccurrencePattern
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CoOccurrencePattern
impl Debug for CoOccurrencePattern
Source§impl<'de> Deserialize<'de> for CoOccurrencePattern
impl<'de> Deserialize<'de> for CoOccurrencePattern
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CoOccurrencePattern
impl RefUnwindSafe for CoOccurrencePattern
impl Send for CoOccurrencePattern
impl Sync for CoOccurrencePattern
impl Unpin for CoOccurrencePattern
impl UnwindSafe for CoOccurrencePattern
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