Skip to main content

AnomalyInjector

Struct AnomalyInjector 

Source
pub struct AnomalyInjector { /* private fields */ }
Expand description

Main anomaly injection engine.

Implementations§

Source§

impl AnomalyInjector

Source

pub fn new(config: AnomalyInjectorConfig) -> Self

Creates a new anomaly injector.

Source

pub fn process_entries( &mut self, entries: &mut [JournalEntry], ) -> InjectionBatchResult

Processes a batch of journal entries, potentially injecting anomalies.

Source

pub fn inject_specific( &mut self, entry: &mut JournalEntry, anomaly_type: AnomalyType, ) -> Option<LabeledAnomaly>

Injects a specific anomaly type into an entry.

Source

pub fn create_self_approval( &mut self, entry: &mut JournalEntry, user_id: &str, ) -> Option<LabeledAnomaly>

Creates a self-approval anomaly.

Source

pub fn create_sod_violation( &mut self, entry: &mut JournalEntry, user_id: &str, conflicting_duties: (&str, &str), ) -> Option<LabeledAnomaly>

Creates a segregation of duties violation.

Source

pub fn create_ic_mismatch( &mut self, entry: &mut JournalEntry, matching_company: &str, expected_amount: Decimal, actual_amount: Decimal, ) -> Option<LabeledAnomaly>

Creates an intercompany mismatch anomaly.

Source

pub fn get_labels(&self) -> &[LabeledAnomaly]

Returns all generated labels.

Source

pub fn get_summary(&self) -> AnomalySummary

Returns the anomaly summary.

Source

pub fn get_stats(&self) -> &InjectorStats

Returns injection statistics.

Source

pub fn reset(&mut self)

Clears all labels and resets statistics.

Source

pub fn cluster_count(&self) -> usize

Returns the number of clusters created.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V