pub enum RepetitionState {
Reviewing {
ease_factor: f64,
last_repetition: DateTime<Utc>,
next_repetition: DateTime<Utc>,
},
Learning {
easy_count: i16,
stage: u16,
next_repetition: DateTime<Utc>,
},
}Expand description
The repetition state of a learnable item.
Variants§
Reviewing
The item has made it through the initial learning phase and will now be repeated at larger intervals.
Fields
Learning
The item is in the initial learning phase where it is repeated in shorter intervals.
Fields
easy_count: i16The count of easy repetition results. RepetitionResult::Easy increments this by one, and RepetitionResult::Hard and RepetitionResult::Again decrement this by one.
Implementations§
Source§impl RepetitionState
impl RepetitionState
Sourcepub fn new<TZ: TimeZone>(datetime: DateTime<TZ>) -> Self
pub fn new<TZ: TimeZone>(datetime: DateTime<TZ>) -> Self
Construct a new repetition state in learning stage 0, with its first repetition being at the given datetime.
Sourcepub fn update<TZ: TimeZone>(
self,
datetime: DateTime<TZ>,
result: RepetitionResult,
configuration: &Configuration,
) -> Result<Self, Error>
pub fn update<TZ: TimeZone>( self, datetime: DateTime<TZ>, result: RepetitionResult, configuration: &Configuration, ) -> Result<Self, Error>
Update the repetition state after an item was repeated by the user.
The time of the repetition was datetime, and the result of the repetition was result.
The configuration of the algorithm is given as configuration.
The source of randomness used for jitter is rand::thread_rng.
Sourcepub fn update_with_rng<TZ: TimeZone, RngType: Rng>(
self,
datetime: DateTime<TZ>,
result: RepetitionResult,
configuration: &Configuration,
rng: &mut RngType,
) -> Result<Self, Error>
pub fn update_with_rng<TZ: TimeZone, RngType: Rng>( self, datetime: DateTime<TZ>, result: RepetitionResult, configuration: &Configuration, rng: &mut RngType, ) -> Result<Self, Error>
Update the repetition state after an item was repeated by the user.
The time of the repetition was datetime, and the result of the repetition was result.
The configuration of the algorithm is given as configuration.
The given rng is the source of randomness used for jitter.
Trait Implementations§
Source§impl Clone for RepetitionState
impl Clone for RepetitionState
Source§fn clone(&self) -> RepetitionState
fn clone(&self) -> RepetitionState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more