pub struct Learnings { /* private fields */ }Expand description
Every learning the factory holds, across all agents.
Implementations§
Source§impl Learnings
impl Learnings
Sourcepub fn from_entries(entries: Vec<Learning>) -> Self
pub fn from_entries(entries: Vec<Learning>) -> Self
Rebuilds from stored learnings.
Sourcepub fn all(&self) -> impl Iterator<Item = &Learning>
pub fn all(&self) -> impl Iterator<Item = &Learning>
Every learning, in the order they were first proposed.
Sourcepub fn get(&self, id: &LearningId) -> Option<&Learning>
pub fn get(&self, id: &LearningId) -> Option<&Learning>
Finds one by identifier.
Sourcepub fn active_for(&self, agent: &AgentName) -> Vec<&Learning>
pub fn active_for(&self, agent: &AgentName) -> Vec<&Learning>
The learnings an agent’s next run should be given, oldest first.
Confirmed ones lead, because they have earned their place, and a run that has to skim is better off skimming the provisional tail.
Sourcepub fn propose(&mut self, proposal: &Proposal) -> Uptake
pub fn propose(&mut self, proposal: &Proposal) -> Uptake
Takes up a proposal, or explains why it was not taken up.
Sourcepub fn charge_run(&mut self, agent: &AgentName) -> Vec<LearningId>
pub fn charge_run(&mut self, agent: &AgentName) -> Vec<LearningId>
Charges one run against agent’s provisional learnings, lapsing any that run out.
Returns the learnings that lapsed, so the caller can say so rather than have advice disappear silently.
Sourcepub fn confirm(&mut self, id: &LearningId, at: Timestamp) -> bool
pub fn confirm(&mut self, id: &LearningId, at: Timestamp) -> bool
Marks a learning permanent, as a human confirming what they have read.
The ordinary path to State::Confirmed is rediscovery; this is the shortcut for an
operator who already knows the insight is right and does not want to wait for the factory
to work it out twice more.
Sourcepub fn reject(&mut self, id: &LearningId, at: Timestamp) -> bool
pub fn reject(&mut self, id: &LearningId, at: Timestamp) -> bool
Refuses a learning for good.
This is the revocation path, and the reason applying immediately is defensible: when a learning turns out to be wrong there is one place to go and one thing to press.