pub struct GenerationSession { /* private fields */ }Expand description
A multi-period generation session with checkpoint/resume support.
The session decomposes the total requested time span into fiscal-year-aligned periods and generates each one sequentially, carrying forward balance and ID state between periods.
Implementations§
Source§impl GenerationSession
impl GenerationSession
Sourcepub fn new(
config: GeneratorConfig,
output_path: PathBuf,
) -> Result<Self, SynthError>
pub fn new( config: GeneratorConfig, output_path: PathBuf, ) -> Result<Self, SynthError>
Create a new session from a config and output path.
The total time span is decomposed into fiscal-year-aligned periods
based on config.global.fiscal_year_months (defaults to period_months
if not set, yielding a single period).
Sourcepub fn resume(path: &Path, config: GeneratorConfig) -> Result<Self, SynthError>
pub fn resume(path: &Path, config: GeneratorConfig) -> Result<Self, SynthError>
Resume a session from a .dss checkpoint file.
The config hash is verified against the checkpoint to ensure the config has not changed since the session was last saved.
Sourcepub fn save(&self, path: &Path) -> Result<(), SynthError>
pub fn save(&self, path: &Path) -> Result<(), SynthError>
Persist the current session state to a .dss file.
Sourcepub fn generate_next_period(
&mut self,
) -> Result<Option<PeriodResult>, SynthError>
pub fn generate_next_period( &mut self, ) -> Result<Option<PeriodResult>, SynthError>
Generate the next period in the sequence.
Returns Ok(None) if all periods have been generated.
Sourcepub fn generate_all(&mut self) -> Result<Vec<PeriodResult>, SynthError>
pub fn generate_all(&mut self) -> Result<Vec<PeriodResult>, SynthError>
Generate all remaining periods in the sequence.
Sourcepub fn generate_delta(
&mut self,
additional_months: u32,
) -> Result<Vec<PeriodResult>, SynthError>
pub fn generate_delta( &mut self, additional_months: u32, ) -> Result<Vec<PeriodResult>, SynthError>
Extend the session with additional months and generate them.
Sourcepub fn state(&self) -> &SessionState
pub fn state(&self) -> &SessionState
Read-only access to the session state.
Sourcepub fn periods(&self) -> &[GenerationPeriod]
pub fn periods(&self) -> &[GenerationPeriod]
Read-only access to the period list.
Sourcepub fn remaining_periods(&self) -> usize
pub fn remaining_periods(&self) -> usize
Number of periods that have not yet been generated.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GenerationSession
impl RefUnwindSafe for GenerationSession
impl Send for GenerationSession
impl Sync for GenerationSession
impl Unpin for GenerationSession
impl UnsafeUnpin for GenerationSession
impl UnwindSafe for GenerationSession
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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.