pub struct LessonLibrary { /* private fields */ }Expand description
Lesson library that stores all available lessons
Implementations§
Source§impl LessonLibrary
impl LessonLibrary
pub fn new() -> Self
Sourcepub fn all(&self) -> Vec<&Lesson>
pub fn all(&self) -> Vec<&Lesson>
All lessons in learning order: registration order, except that a lesson always comes after the prerequisites it names. Stable across runs (the map used to come out in random order).
Sourcepub fn by_difficulty(&self, difficulty: Difficulty) -> Vec<&Lesson>
pub fn by_difficulty(&self, difficulty: Difficulty) -> Vec<&Lesson>
Operator-track lessons at this difficulty: the ladder the difficulty badges measure (Explorer has its own badge)
Sourcepub fn difficulty_counts(&self) -> HashMap<Difficulty, usize>
pub fn difficulty_counts(&self) -> HashMap<Difficulty, usize>
Count lessons per difficulty level (used for achievement unlock checks)
Sourcepub fn load_from_dir(&mut self, path: &Path) -> Result<usize>
pub fn load_from_dir(&mut self, path: &Path) -> Result<usize>
Load user-provided *.toml lesson files from a directory and merge
them with the built-in lessons. User lessons override built-ins with
the same id. Returns the number of lessons loaded.
A missing directory is not an error (returns 0); an unreadable or unparsable lesson file is.
Trait Implementations§
Source§impl Clone for LessonLibrary
impl Clone for LessonLibrary
Source§impl Debug for LessonLibrary
impl Debug for LessonLibrary
Auto Trait Implementations§
impl Freeze for LessonLibrary
impl RefUnwindSafe for LessonLibrary
impl Send for LessonLibrary
impl Sync for LessonLibrary
impl Unpin for LessonLibrary
impl UnsafeUnpin for LessonLibrary
impl UnwindSafe for LessonLibrary
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