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§

source

fn get_course_manifest(&self, course_id: &Ustr) -> Option<CourseManifest>

Returns the course manifest for the given course.

source

fn get_lesson_manifest(&self, lesson_id: &Ustr) -> Option<LessonManifest>

Returns the lesson manifest for the given lesson.

source

fn get_exercise_manifest(&self, exercise_id: &Ustr) -> Option<ExerciseManifest>

Returns the exercise manifest for the given exercise.

source

fn get_course_ids(&self) -> Vec<Ustr>

Returns the IDs of all courses in the library sorted alphabetically.

source

fn get_lesson_ids(&self, course_id: &Ustr) -> Result<Vec<Ustr>>

Returns the IDs of all lessons in the given course sorted alphabetically.

source

fn get_exercise_ids(&self, lesson_id: &Ustr) -> Result<Vec<Ustr>>

Returns the IDs of all exercises in the given lesson sorted alphabetically.

source

fn get_all_exercise_ids(&self) -> Result<Vec<Ustr>>

Returns the IDs of all exercises in the given course sorted alphabetically.

source

fn search(&self, query: &str) -> Result<Vec<Ustr>>

Returns the IDs of all the units which match the given query.

source

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.

Implementors§