pub struct ExpenseReportGenerator { /* private fields */ }Expand description
Generates ExpenseReport records for employees over a period.
Implementations§
Source§impl ExpenseReportGenerator
impl ExpenseReportGenerator
Sourcepub fn new(seed: u64) -> Self
pub fn new(seed: u64) -> Self
Create a new expense report generator with default configuration.
Sourcepub fn with_config(seed: u64, config: ExpenseConfig) -> Self
pub fn with_config(seed: u64, config: ExpenseConfig) -> Self
Create an expense report generator with custom configuration.
Sourcepub fn set_temporal_context(&mut self, ctx: Arc<TemporalContext>)
pub fn set_temporal_context(&mut self, ctx: Arc<TemporalContext>)
Set the shared TemporalContext so submission / approval / paid /
line-item dates snap to the next business day.
Sourcepub fn with_temporal_context(self, ctx: Arc<TemporalContext>) -> Self
pub fn with_temporal_context(self, ctx: Arc<TemporalContext>) -> Self
Builder variant of Self::set_temporal_context.
Sourcepub fn set_country_pack(&mut self, pack: CountryPack)
pub fn set_country_pack(&mut self, pack: CountryPack)
Set the country pack for locale-aware generation.
When set, the generator can use locale-specific currencies and business rules from the country pack. Currently the pack is stored for future expansion; existing behaviour is unchanged when no pack is provided.
Sourcepub fn with_pools(
self,
employee_ids: Vec<String>,
cost_center_ids: Vec<String>,
) -> Self
pub fn with_pools( self, employee_ids: Vec<String>, cost_center_ids: Vec<String>, ) -> Self
Set ID pools for cross-reference coherence.
When pools are non-empty, the generator selects approved_by from
employee_ids and cost_center from cost_center_ids instead of
fabricating placeholder IDs.
Sourcepub fn with_employee_names(self, names: HashMap<String, String>) -> Self
pub fn with_employee_names(self, names: HashMap<String, String>) -> Self
Set the employee name mapping for denormalization (DS-011).
Maps employee IDs to their display names so that generated expense reports include the employee name for graph export convenience.
Sourcepub fn generate_from_config(
&mut self,
employee_ids: &[String],
period_start: NaiveDate,
period_end: NaiveDate,
) -> Vec<ExpenseReport>
pub fn generate_from_config( &mut self, employee_ids: &[String], period_start: NaiveDate, period_end: NaiveDate, ) -> Vec<ExpenseReport>
Generate expense reports using the stored config and country pack.
Uses self.config for submission rate and policy thresholds, and
self.country_pack for locale-specific currency.
Sourcepub fn generate(
&mut self,
employee_ids: &[String],
period_start: NaiveDate,
period_end: NaiveDate,
config: &ExpenseConfig,
) -> Vec<ExpenseReport>
pub fn generate( &mut self, employee_ids: &[String], period_start: NaiveDate, period_end: NaiveDate, config: &ExpenseConfig, ) -> Vec<ExpenseReport>
Generate expense reports for employees over the given period.
Only config.submission_rate fraction of employees submit reports each
month within the period.
§Arguments
employee_ids- Slice of employee identifiersperiod_start- Start of the period (inclusive)period_end- End of the period (inclusive)config- Expense management configuration (overrides stored config)
Sourcepub fn generate_with_currency(
&mut self,
employee_ids: &[String],
period_start: NaiveDate,
period_end: NaiveDate,
config: &ExpenseConfig,
currency: &str,
) -> Vec<ExpenseReport>
pub fn generate_with_currency( &mut self, employee_ids: &[String], period_start: NaiveDate, period_end: NaiveDate, config: &ExpenseConfig, currency: &str, ) -> Vec<ExpenseReport>
Generate expense reports with a specific company currency.
Auto Trait Implementations§
impl !Freeze for ExpenseReportGenerator
impl RefUnwindSafe for ExpenseReportGenerator
impl Send for ExpenseReportGenerator
impl Sync for ExpenseReportGenerator
impl Unpin for ExpenseReportGenerator
impl UnsafeUnpin for ExpenseReportGenerator
impl UnwindSafe for ExpenseReportGenerator
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.