pub struct SegmentGenerator { /* private fields */ }Expand description
Generates IFRS 8 / ASC 280 segment reporting data.
Implementations§
Source§impl SegmentGenerator
impl SegmentGenerator
Sourcepub fn generate(
&mut self,
company_code: &str,
period: &str,
consolidated_revenue: Decimal,
consolidated_profit: Decimal,
consolidated_assets: Decimal,
entity_seeds: &[SegmentSeed],
total_depreciation: Option<Decimal>,
) -> (Vec<OperatingSegment>, SegmentReconciliation)
pub fn generate( &mut self, company_code: &str, period: &str, consolidated_revenue: Decimal, consolidated_profit: Decimal, consolidated_assets: Decimal, entity_seeds: &[SegmentSeed], total_depreciation: Option<Decimal>, ) -> (Vec<OperatingSegment>, SegmentReconciliation)
Generate operating segments and a reconciliation for one fiscal period.
§Arguments
company_code– group / parent company code used in output recordsperiod– fiscal period label (e.g. “2024-03”)consolidated_revenue– total external revenue from the consolidated ISconsolidated_profit– consolidated operating profitconsolidated_assets– consolidated total assetsentity_seeds– one entry per legal entity / product line to derive segments fromtotal_depreciation– consolidated D&A from the depreciation run (e.g.DepreciationRun.total_depreciation). WhenSome, distributed to segments proportionally to their share of total assets. WhenNone, D&A is approximated as 50–80 % of each segment’s CapEx (a reasonable synthetic-data heuristic).
§Returns
(segments, reconciliation) where the reconciliation ties segment totals
back to the consolidated figures passed in.
Sourcepub fn generate_from_journal_entries(
&mut self,
journal_entries: &[JournalEntry],
companies: &[(String, String)],
period: &str,
ic_elimination_amount: Decimal,
) -> (Vec<OperatingSegment>, SegmentReconciliation)
pub fn generate_from_journal_entries( &mut self, journal_entries: &[JournalEntry], companies: &[(String, String)], period: &str, ic_elimination_amount: Decimal, ) -> (Vec<OperatingSegment>, SegmentReconciliation)
Generate operating segments from actual journal entry data per entity.
For each company, aggregates JEs by GL account prefix:
- Revenue (4xxx): net credits
- COGS (5xxx): net debits
- OpEx (6xxx + 7xxx): net debits
- Assets (1xxx): debit balances (snapshot from all entries)
- Liabilities (2xxx): credit balances
§Arguments
journal_entries– slice of all journal entries to aggregatecompanies–(code, name)tuples identifying each segment entityperiod– fiscal period label (e.g."2025-Q1")ic_elimination_amount– known intercompany elimination to embed in the reconciliation
§Returns
(segments, reconciliation) where each segment corresponds to one company
and the reconciliation ties all segment totals to the consolidated figures.
Auto Trait Implementations§
impl !Freeze for SegmentGenerator
impl RefUnwindSafe for SegmentGenerator
impl Send for SegmentGenerator
impl Sync for SegmentGenerator
impl Unpin for SegmentGenerator
impl UnsafeUnpin for SegmentGenerator
impl UnwindSafe for SegmentGenerator
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