pub struct Trane { /* private fields */ }Expand description
Trane is a library for the acquisition of highly hierarchical knowledge and skills based on the principles of mastery learning and spaced repetition. Given a list of courses, its lessons and corresponding exercises, Trane presents the student with a list of exercises based on the demonstrated mastery of previous exercises. It makes sure that new material and skills are not introduced until the prerequisite material and skills have been sufficiently mastered.
Implementations§
Source§impl Trane
impl Trane
Sourcepub fn new_local(working_dir: &Path, library_root: &Path) -> Result<Trane>
pub fn new_local(working_dir: &Path, library_root: &Path) -> Result<Trane>
Creates a new local instance of the Trane given the path to the root of a course library.
The user data will be stored in a directory named .trane inside the library root
directory. The working directory will be used to resolve relative paths.
Sourcepub fn new_local_from_serialized(
library_root: &Path,
serialized_library: SerializedCourseLibrary,
) -> Result<Trane>
pub fn new_local_from_serialized( library_root: &Path, serialized_library: SerializedCourseLibrary, ) -> Result<Trane>
Creates a new local instance of the Trane given the path to the root of a course library.
The user data will be stored in a directory named .trane inside the library root
directory. The working directory will be used to resolve relative paths.
Sourcepub fn library_root(&self) -> String
pub fn library_root(&self) -> String
Returns the path to the root of the course library.
Trait Implementations§
Source§impl Blacklist for Trane
impl Blacklist for Trane
Source§fn add_to_blacklist(&mut self, unit_id: Ustr) -> Result<(), BlacklistError>
fn add_to_blacklist(&mut self, unit_id: Ustr) -> Result<(), BlacklistError>
Source§fn remove_from_blacklist(&mut self, unit_id: Ustr) -> Result<(), BlacklistError>
fn remove_from_blacklist(&mut self, unit_id: Ustr) -> Result<(), BlacklistError>
Source§fn remove_prefix_from_blacklist(
&mut self,
prefix: &str,
) -> Result<(), BlacklistError>
fn remove_prefix_from_blacklist( &mut self, prefix: &str, ) -> Result<(), BlacklistError>
Source§fn blacklisted(&self, unit_id: Ustr) -> Result<bool, BlacklistError>
fn blacklisted(&self, unit_id: Ustr) -> Result<bool, BlacklistError>
Source§fn get_blacklist_entries(&self) -> Result<Vec<Ustr>, BlacklistError>
fn get_blacklist_entries(&self) -> Result<Vec<Ustr>, BlacklistError>
Source§impl CourseLibrary for Trane
impl CourseLibrary for Trane
Source§fn get_course_manifest(&self, course_id: Ustr) -> Option<CourseManifest>
fn get_course_manifest(&self, course_id: Ustr) -> Option<CourseManifest>
Source§fn get_lesson_manifest(&self, lesson_id: Ustr) -> Option<LessonManifest>
fn get_lesson_manifest(&self, lesson_id: Ustr) -> Option<LessonManifest>
Source§fn get_exercise_manifest(&self, exercise_id: Ustr) -> Option<ExerciseManifest>
fn get_exercise_manifest(&self, exercise_id: Ustr) -> Option<ExerciseManifest>
Source§fn get_course_ids(&self) -> Vec<Ustr>
fn get_course_ids(&self) -> Vec<Ustr>
Source§fn get_lesson_ids(&self, course_id: Ustr) -> Option<Vec<Ustr>>
fn get_lesson_ids(&self, course_id: Ustr) -> Option<Vec<Ustr>>
Source§fn get_exercise_ids(&self, lesson_id: Ustr) -> Option<Vec<Ustr>>
fn get_exercise_ids(&self, lesson_id: Ustr) -> Option<Vec<Ustr>>
Source§fn get_all_exercise_ids(&self, unit_id: Option<Ustr>) -> Vec<Ustr>
fn get_all_exercise_ids(&self, unit_id: Option<Ustr>) -> Vec<Ustr>
Source§impl ExerciseScheduler for Trane
impl ExerciseScheduler for Trane
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>
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>
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>
Source§fn invalidate_cached_score(&self, unit_id: Ustr)
fn invalidate_cached_score(&self, unit_id: Ustr)
Source§fn invalidate_cached_scores_with_prefix(&self, prefix: &str)
fn invalidate_cached_scores_with_prefix(&self, prefix: &str)
invalidate_cached_score apply.Source§fn get_scheduler_options(&self) -> SchedulerOptions
fn get_scheduler_options(&self) -> SchedulerOptions
Source§fn set_scheduler_options(&mut self, options: SchedulerOptions)
fn set_scheduler_options(&mut self, options: SchedulerOptions)
Source§fn reset_scheduler_options(&mut self)
fn reset_scheduler_options(&mut self)
Source§impl FilterManager for Trane
impl FilterManager for Trane
Source§fn get_filter(&self, id: &str) -> Option<SavedFilter>
fn get_filter(&self, id: &str) -> Option<SavedFilter>
Source§impl PracticeRewards for Trane
impl PracticeRewards for Trane
Source§fn get_rewards(
&self,
unit_id: Ustr,
num_rewards: usize,
) -> Result<Vec<UnitReward>, PracticeRewardsError>
fn get_rewards( &self, unit_id: Ustr, num_rewards: usize, ) -> Result<Vec<UnitReward>, PracticeRewardsError>
Source§fn record_unit_reward(
&mut self,
unit_id: Ustr,
reward: &UnitReward,
) -> Result<bool, PracticeRewardsError>
fn record_unit_reward( &mut self, unit_id: Ustr, reward: &UnitReward, ) -> Result<bool, PracticeRewardsError>
false.Source§fn trim_rewards(
&mut self,
num_rewards: usize,
) -> Result<(), PracticeRewardsError>
fn trim_rewards( &mut self, num_rewards: usize, ) -> Result<(), PracticeRewardsError>
Source§fn remove_rewards_with_prefix(
&mut self,
prefix: &str,
) -> Result<(), PracticeRewardsError>
fn remove_rewards_with_prefix( &mut self, prefix: &str, ) -> Result<(), PracticeRewardsError>
Source§impl PracticeStats for Trane
impl PracticeStats for Trane
Source§fn get_scores(
&self,
exercise_id: Ustr,
num_scores: usize,
) -> Result<Vec<ExerciseTrial>, PracticeStatsError>
fn get_scores( &self, exercise_id: Ustr, num_scores: usize, ) -> Result<Vec<ExerciseTrial>, PracticeStatsError>
num_scores scores of a particular exercise. The scores are returned in
descending order according to the timestamp.Source§fn record_exercise_score(
&mut self,
exercise_id: Ustr,
score: MasteryScore,
timestamp: i64,
) -> Result<(), PracticeStatsError>
fn record_exercise_score( &mut self, exercise_id: Ustr, score: MasteryScore, timestamp: i64, ) -> Result<(), PracticeStatsError>
MasteryScore enum instead of a float. Only units of type UnitType::Exercise
should have scores recorded. However, the enforcement of this requirement is left to the
caller.Source§fn trim_scores(&mut self, num_scores: usize) -> Result<(), PracticeStatsError>
fn trim_scores(&mut self, num_scores: usize) -> Result<(), PracticeStatsError>
num_scores with the aim of keeping the
storage size under check.Source§fn remove_scores_with_prefix(
&mut self,
prefix: &str,
) -> Result<(), PracticeStatsError>
fn remove_scores_with_prefix( &mut self, prefix: &str, ) -> Result<(), PracticeStatsError>
Source§impl PreferencesManager for Trane
impl PreferencesManager for Trane
Source§fn get_user_preferences(
&self,
) -> Result<UserPreferences, PreferencesManagerError>
fn get_user_preferences( &self, ) -> Result<UserPreferences, PreferencesManagerError>
Source§fn set_user_preferences(
&mut self,
preferences: UserPreferences,
) -> Result<(), PreferencesManagerError>
fn set_user_preferences( &mut self, preferences: UserPreferences, ) -> Result<(), PreferencesManagerError>
Source§impl ReviewList for Trane
impl ReviewList for Trane
Source§fn add_to_review_list(&mut self, unit_id: Ustr) -> Result<(), ReviewListError>
fn add_to_review_list(&mut self, unit_id: Ustr) -> Result<(), ReviewListError>
Source§fn remove_from_review_list(
&mut self,
unit_id: Ustr,
) -> Result<(), ReviewListError>
fn remove_from_review_list( &mut self, unit_id: Ustr, ) -> Result<(), ReviewListError>
Source§fn get_review_list_entries(&self) -> Result<Vec<Ustr>, ReviewListError>
fn get_review_list_entries(&self) -> Result<Vec<Ustr>, ReviewListError>
Source§impl StudySessionManager for Trane
impl StudySessionManager for Trane
Source§fn get_study_session(&self, id: &str) -> Option<StudySession>
fn get_study_session(&self, id: &str) -> Option<StudySession>
Source§impl UnitGraph for Trane
impl UnitGraph for Trane
Source§fn add_course(&mut self, course_id: Ustr) -> Result<(), UnitGraphError>
fn add_course(&mut self, course_id: Ustr) -> Result<(), UnitGraphError>
Source§fn add_lesson(
&mut self,
lesson_id: Ustr,
course_id: Ustr,
) -> Result<(), UnitGraphError>
fn add_lesson( &mut self, lesson_id: Ustr, course_id: Ustr, ) -> Result<(), UnitGraphError>
Source§fn add_exercise(
&mut self,
exercise_id: Ustr,
lesson_id: Ustr,
) -> Result<(), UnitGraphError>
fn add_exercise( &mut self, exercise_id: Ustr, lesson_id: Ustr, ) -> Result<(), UnitGraphError>
Source§fn add_dependencies(
&mut self,
unit_id: Ustr,
unit_type: UnitType,
dependencies: &[Ustr],
) -> Result<(), UnitGraphError>
fn add_dependencies( &mut self, unit_id: Ustr, unit_type: UnitType, dependencies: &[Ustr], ) -> Result<(), UnitGraphError>
unit_type is UnitType::Exercise as only courses and lessons are allowed to have
dependencies. An error is also returned if the unit was not previously added by calling one
of add_course or add_lesson.Source§fn add_encompassed(
&mut self,
unit_id: Ustr,
dependencies: &[Ustr],
encompassed: &[(Ustr, f32)],
) -> Result<(), UnitGraphError>
fn add_encompassed( &mut self, unit_id: Ustr, dependencies: &[Ustr], encompassed: &[(Ustr, f32)], ) -> Result<(), UnitGraphError>
Source§fn set_encompasing_equals_dependency(&mut self)
fn set_encompasing_equals_dependency(&mut self)
UnitGraph that the encompassing and dependency graphs are the same. That is, no
manifest explicitly declared encompassed units. In this case, the encompassing graph is
identical to the dependency graph with all weights set to 1.0. The caller should use this
function after building the full graph to avoid the overhead of storing two identical
graphs.Source§fn encompasing_equals_dependency(&self) -> bool
fn encompasing_equals_dependency(&self) -> bool
Source§fn add_superseded(&mut self, unit_id: Ustr, superseded: &[Ustr])
fn add_superseded(&mut self, unit_id: Ustr, superseded: &[Ustr])
Source§fn get_unit_type(&self, unit_id: Ustr) -> Option<UnitType>
fn get_unit_type(&self, unit_id: Ustr) -> Option<UnitType>
Source§fn get_course_lessons(&self, course_id: Ustr) -> Option<UstrSet>
fn get_course_lessons(&self, course_id: Ustr) -> Option<UstrSet>
Source§fn get_starting_lessons(&self, course_id: Ustr) -> Option<UstrSet>
fn get_starting_lessons(&self, course_id: Ustr) -> Option<UstrSet>
Source§fn update_starting_lessons(&mut self)
fn update_starting_lessons(&mut self)
Source§fn get_lesson_course(&self, lesson_id: Ustr) -> Option<Ustr>
fn get_lesson_course(&self, lesson_id: Ustr) -> Option<Ustr>
Source§fn get_lesson_exercises(&self, lesson_id: Ustr) -> Option<UstrSet>
fn get_lesson_exercises(&self, lesson_id: Ustr) -> Option<UstrSet>
Source§fn get_exercise_lesson(&self, exercise_id: Ustr) -> Option<Ustr>
fn get_exercise_lesson(&self, exercise_id: Ustr) -> Option<Ustr>
Source§fn get_dependencies(&self, unit_id: Ustr) -> Option<UstrSet>
fn get_dependencies(&self, unit_id: Ustr) -> Option<UstrSet>
Source§fn get_dependents(&self, unit_id: Ustr) -> Option<UstrSet>
fn get_dependents(&self, unit_id: Ustr) -> Option<UstrSet>
Source§fn get_encompasses(&self, unit_id: Ustr) -> Option<Vec<(Ustr, f32)>>
fn get_encompasses(&self, unit_id: Ustr) -> Option<Vec<(Ustr, f32)>>
Source§fn get_encompassed_by(&self, unit_id: Ustr) -> Option<Vec<(Ustr, f32)>>
fn get_encompassed_by(&self, unit_id: Ustr) -> Option<Vec<(Ustr, f32)>>
Source§fn get_dependency_sinks(&self) -> UstrSet
fn get_dependency_sinks(&self) -> UstrSet
Source§fn get_supersedes(&self, unit_id: Ustr) -> Option<UstrSet>
fn get_supersedes(&self, unit_id: Ustr) -> Option<UstrSet>
Source§fn get_superseded_by(&self, unit_id: Ustr) -> Option<UstrSet>
fn get_superseded_by(&self, unit_id: Ustr) -> Option<UstrSet>
Source§fn check_cycles(&self) -> Result<(), UnitGraphError>
fn check_cycles(&self) -> Result<(), UnitGraphError>
impl Send for Trane
impl Sync for Trane
Auto Trait Implementations§
impl !Freeze for Trane
impl !RefUnwindSafe for Trane
impl Unpin for Trane
impl UnsafeUnpin for Trane
impl !UnwindSafe for Trane
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
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>
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>
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)
&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)
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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