pub struct DepthFirstScheduler { /* private fields */ }Expand description
An implementation of ExerciseScheduler based on depth-first search.
Implementations§
Source§impl DepthFirstScheduler
impl DepthFirstScheduler
Sourcepub fn new(data: SchedulerData) -> Self
pub fn new(data: SchedulerData) -> Self
Creates a new scheduler.
Sourcepub fn get_course_valid_starting_lessons(
&self,
course_id: Ustr,
metadata_filter: Option<&KeyValueFilter>,
) -> Result<Vec<Ustr>>
pub fn get_course_valid_starting_lessons( &self, course_id: Ustr, metadata_filter: Option<&KeyValueFilter>, ) -> Result<Vec<Ustr>>
Returns the lessons in the course that have no dependencies with other lessons in the course and whose dependencies are satisfied.
Trait Implementations§
Source§impl ExerciseScheduler for DepthFirstScheduler
impl ExerciseScheduler for DepthFirstScheduler
Source§fn get_exercise_batch(
&self,
filter: Option<ExerciseFilter>,
) -> Result<Vec<ExerciseManifest>, ExerciseSchedulerError>
fn get_exercise_batch( &self, filter: Option<ExerciseFilter>, ) -> Result<Vec<ExerciseManifest>, ExerciseSchedulerError>
Gets a new batch of exercises scheduled for a new trial. Contains an optimal filter to
restrict the units visited during the search with the purpose of allowing students to choose
which material to practice. If the filter is not provided, the scheduler will search the
entire graph.
Source§fn score_exercise(
&self,
exercise_id: Ustr,
score: MasteryScore,
timestamp: i64,
) -> Result<(), ExerciseSchedulerError>
fn score_exercise( &self, exercise_id: Ustr, score: MasteryScore, timestamp: i64, ) -> Result<(), ExerciseSchedulerError>
Records the score of the given exercise’s trial. The scores are used by the scheduler to
decide when to stop traversing a path and how to sort and filter all the found candidates
into a final batch.
Source§fn get_unit_score(
&self,
unit_id: Ustr,
) -> Result<Option<f32>, ExerciseSchedulerError>
fn get_unit_score( &self, unit_id: Ustr, ) -> Result<Option<f32>, ExerciseSchedulerError>
Gets the score for the given unit. The unit can be a course, lesson, or exercise.
Source§fn invalidate_cached_score(&self, unit_id: Ustr)
fn invalidate_cached_score(&self, unit_id: Ustr)
Removes any cached scores for the given unit. The score will be recomputed the next time the
score is needed. Read more
Source§fn invalidate_cached_scores_with_prefix(&self, prefix: &str)
fn invalidate_cached_scores_with_prefix(&self, prefix: &str)
Removes any cached scores from units with the given prefix. The same considerations as
invalidate_cached_score apply.Source§fn get_scheduler_options(&self) -> SchedulerOptions
fn get_scheduler_options(&self) -> SchedulerOptions
Returns the options used to control the behavior of the scheduler.
Source§fn set_scheduler_options(&mut self, options: SchedulerOptions)
fn set_scheduler_options(&mut self, options: SchedulerOptions)
Sets the options used to control the behavior of the scheduler.
Source§fn reset_scheduler_options(&mut self)
fn reset_scheduler_options(&mut self)
Resets the options used to control the behavior of the scheduler to their default values.
Auto Trait Implementations§
impl !Freeze for DepthFirstScheduler
impl !RefUnwindSafe for DepthFirstScheduler
impl !Send for DepthFirstScheduler
impl !Sync for DepthFirstScheduler
impl Unpin for DepthFirstScheduler
impl UnsafeUnpin for DepthFirstScheduler
impl !UnwindSafe for DepthFirstScheduler
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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