Trait trane::course_library::CourseLibrary
source · pub trait CourseLibrary {
// Required methods
fn get_course_manifest(&self, course_id: &Ustr) -> Option<CourseManifest>;
fn get_lesson_manifest(&self, lesson_id: &Ustr) -> Option<LessonManifest>;
fn get_exercise_manifest(
&self,
exercise_id: &Ustr
) -> Option<ExerciseManifest>;
fn get_course_ids(&self) -> Vec<Ustr>;
fn get_lesson_ids(&self, course_id: &Ustr) -> Result<Vec<Ustr>>;
fn get_exercise_ids(&self, lesson_id: &Ustr) -> Result<Vec<Ustr>>;
fn get_all_exercise_ids(&self) -> Result<Vec<Ustr>>;
fn search(&self, query: &str) -> Result<Vec<Ustr>>;
fn get_user_preferences(&self) -> UserPreferences;
}Expand description
A trait that manages a course library, its corresponding manifest files, and provides basic operations to retrieve the courses, lessons in a course, and exercises in a lesson.
Required Methods§
sourcefn get_course_manifest(&self, course_id: &Ustr) -> Option<CourseManifest>
fn get_course_manifest(&self, course_id: &Ustr) -> Option<CourseManifest>
Returns the course manifest for the given course.
sourcefn get_lesson_manifest(&self, lesson_id: &Ustr) -> Option<LessonManifest>
fn get_lesson_manifest(&self, lesson_id: &Ustr) -> Option<LessonManifest>
Returns the lesson manifest for the given lesson.
sourcefn get_exercise_manifest(&self, exercise_id: &Ustr) -> Option<ExerciseManifest>
fn get_exercise_manifest(&self, exercise_id: &Ustr) -> Option<ExerciseManifest>
Returns the exercise manifest for the given exercise.
sourcefn get_course_ids(&self) -> Vec<Ustr>
fn get_course_ids(&self) -> Vec<Ustr>
Returns the IDs of all courses in the library sorted alphabetically.
sourcefn get_lesson_ids(&self, course_id: &Ustr) -> Result<Vec<Ustr>>
fn get_lesson_ids(&self, course_id: &Ustr) -> Result<Vec<Ustr>>
Returns the IDs of all lessons in the given course sorted alphabetically.
sourcefn get_exercise_ids(&self, lesson_id: &Ustr) -> Result<Vec<Ustr>>
fn get_exercise_ids(&self, lesson_id: &Ustr) -> Result<Vec<Ustr>>
Returns the IDs of all exercises in the given lesson sorted alphabetically.
sourcefn get_all_exercise_ids(&self) -> Result<Vec<Ustr>>
fn get_all_exercise_ids(&self) -> Result<Vec<Ustr>>
Returns the IDs of all exercises in the given course sorted alphabetically.
sourcefn search(&self, query: &str) -> Result<Vec<Ustr>>
fn search(&self, query: &str) -> Result<Vec<Ustr>>
Returns the IDs of all the units which match the given query.
sourcefn get_user_preferences(&self) -> UserPreferences
fn get_user_preferences(&self) -> UserPreferences
Returns the user preferences found in the library. The default preferences should be returned if the user preferences file is not found.