trellis_runner/state/user.rs
1use crate::progress::Progress;
2use crate::TrellisFloat;
3
4/// The user-defined state must implement this trait to be used as part of the trellis calculation
5/// loop
6///
7/// All other state methods are auto-implemented on a type wrapping the user-defined state.
8pub trait UserState {
9 type Float: TrellisFloat;
10 // type Param;
11
12 fn is_initialised(&self) -> bool {
13 true
14 }
15
16 // fn get_param(&self) -> Option<&Self::Param>;
17
18 fn progress(&self) -> Progress<Self::Float>;
19}
20
21pub trait Snapshotable {
22 type Snapshot: Clone + Send + Sync + 'static;
23
24 fn snapshot(&self) -> Self::Snapshot;
25}
26
27pub trait StateRestorer<S: Snapshotable> {
28 fn restore(snapshot: S::Snapshot) -> S;
29}