pub struct CascadeGenerator { /* private fields */ }Expand description
Generator for error cascades.
Implementations§
Source§impl CascadeGenerator
impl CascadeGenerator
Sourcepub fn new(config: CascadeConfig) -> Self
pub fn new(config: CascadeConfig) -> Self
Creates a new cascade generator.
Sourcepub fn maybe_start_cascade<R: Rng>(
&mut self,
trigger: &AnomalyType,
document_id: impl Into<String>,
date: NaiveDate,
rng: &mut R,
) -> Option<Uuid>
pub fn maybe_start_cascade<R: Rng>( &mut self, trigger: &AnomalyType, document_id: impl Into<String>, date: NaiveDate, rng: &mut R, ) -> Option<Uuid>
Starts a new cascade if a template matches.
Sourcepub fn get_due_cascades(&mut self, date: NaiveDate) -> Vec<(Uuid, CascadeStep)>
pub fn get_due_cascades(&mut self, date: NaiveDate) -> Vec<(Uuid, CascadeStep)>
Gets cascades that have steps due on or before a given date.
Sourcepub fn execute_step(
&mut self,
cascade_id: Uuid,
document_id: impl Into<String>,
anomaly_id: impl Into<String>,
)
pub fn execute_step( &mut self, cascade_id: Uuid, document_id: impl Into<String>, anomaly_id: impl Into<String>, )
Marks a cascade step as executed and advances.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Returns active cascade count.
Sourcepub fn completed_count(&self) -> usize
pub fn completed_count(&self) -> usize
Returns completed cascade count.
Sourcepub fn add_template(&mut self, template: CascadeTemplate)
pub fn add_template(&mut self, template: CascadeTemplate)
Adds a custom template.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CascadeGenerator
impl RefUnwindSafe for CascadeGenerator
impl Send for CascadeGenerator
impl Sync for CascadeGenerator
impl Unpin for CascadeGenerator
impl UnsafeUnpin for CascadeGenerator
impl UnwindSafe for CascadeGenerator
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> 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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.