diff --git a/Cargo.lock b/Cargo.lock index 8854206..3ca555c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,7 +67,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "fsrs" -version = "0.4.0" +version = "1.0.0" dependencies = [ "chrono", "serde", diff --git a/src/lib.rs b/src/lib.rs index 4bad2ca..78aa403 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,7 @@ mod scheduler_longterm; pub use scheduler_longterm::LongtermScheduler; mod models; -pub use models::{Card, Rating, ReviewLog, SchedulingInfo, State}; +pub use models::{Card, Rating, RecordLog, ReviewLog, SchedulingInfo, State}; mod parameters; pub use crate::parameters::Parameters; diff --git a/src/scheduler.rs b/src/scheduler.rs index a47848b..3d661ba 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -47,11 +47,9 @@ impl Scheduler { pub trait ImplScheduler { fn preview(&mut self) -> RecordLog { - let mut log = RecordLog::new(); - for rating in Rating::iter() { - log.insert(*rating, self.review(*rating)); - } - log + Rating::iter() + .map(|&rating| (rating, self.review(rating))) + .collect() } fn review(&mut self, rating: Rating) -> SchedulingInfo; }