pub struct KnowledgeDecayModel {
pub states: HashMap<String, MemoryState>,
}Expand description
Manages FSRS memory states for all knowledge facts in a project.
Fields§
§states: HashMap<String, MemoryState>Memory states indexed by stable knowledge-fact key.
Implementations§
Source§impl KnowledgeDecayModel
impl KnowledgeDecayModel
Sourcepub fn load(project_hash: &str) -> Self
pub fn load(project_hash: &str) -> Self
Load a project’s memory schedule, returning an empty model on failure.
Sourcepub fn save(&self, project_hash: &str)
pub fn save(&self, project_hash: &str)
Save a project’s memory schedule to disk when its data directory is available.
Sourcepub fn should_reinject(&self, key: &str, threshold: f64) -> bool
pub fn should_reinject(&self, key: &str, threshold: f64) -> bool
Check whether a fact’s retrievability is below threshold.
Sourcepub fn record_use(&mut self, key: &str, rating: u8)
pub fn record_use(&mut self, key: &str, rating: u8)
Record a fact review or successful use with the supplied FSRS rating.
Sourcepub fn stale_facts(&self, threshold: f64) -> Vec<String>
pub fn stale_facts(&self, threshold: f64) -> Vec<String>
Return fact keys whose retrievability is below threshold.
Sourcepub fn urgency_ranked(&self) -> Vec<(&str, f64)>
pub fn urgency_ranked(&self) -> Vec<(&str, f64)>
Return all facts from lowest to highest retrievability.
Trait Implementations§
Source§impl Clone for KnowledgeDecayModel
impl Clone for KnowledgeDecayModel
Source§fn clone(&self) -> KnowledgeDecayModel
fn clone(&self) -> KnowledgeDecayModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KnowledgeDecayModel
impl Debug for KnowledgeDecayModel
Source§impl Default for KnowledgeDecayModel
impl Default for KnowledgeDecayModel
Source§fn default() -> KnowledgeDecayModel
fn default() -> KnowledgeDecayModel
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for KnowledgeDecayModel
impl<'de> Deserialize<'de> for KnowledgeDecayModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for KnowledgeDecayModel
impl RefUnwindSafe for KnowledgeDecayModel
impl Send for KnowledgeDecayModel
impl Sync for KnowledgeDecayModel
impl Unpin for KnowledgeDecayModel
impl UnsafeUnpin for KnowledgeDecayModel
impl UnwindSafe for KnowledgeDecayModel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
Converts
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> ⓘ
Converts
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 more