pub struct ExerciseCollection { /* private fields */ }
Implementations§
Source§impl ExerciseCollection
impl ExerciseCollection
pub fn new(exercises_dir: PathBuf) -> Result<Self, Error>
pub fn n_opened(&self) -> Result<usize, Error>
Sourcepub fn opened(&self) -> Result<BTreeSet<OpenedExercise>, Error>
pub fn opened(&self) -> Result<BTreeSet<OpenedExercise>, Error>
Return an iterator over all the workshop-runner that have been opened.
Sourcepub fn next(&mut self) -> Result<Option<ExerciseDefinition>, Error>
pub fn next(&mut self) -> Result<Option<ExerciseDefinition>, Error>
Return the next exercise that should be opened, if we are going through the workshop-runner in the expected order.
Sourcepub fn mark_as_solved(&self, exercise: &ExerciseDefinition) -> Result<(), Error>
pub fn mark_as_solved(&self, exercise: &ExerciseDefinition) -> Result<(), Error>
Record in the database that an exercise was solved, so that it can be skipped next time.
Sourcepub fn mark_as_unsolved(
&self,
exercise: &ExerciseDefinition,
) -> Result<(), Error>
pub fn mark_as_unsolved( &self, exercise: &ExerciseDefinition, ) -> Result<(), Error>
Record in the database that an exercise was not solved, so that it won’t be skipped next time.
Sourcepub fn open(&mut self, exercise: &ExerciseDefinition) -> Result<(), Error>
pub fn open(&mut self, exercise: &ExerciseDefinition) -> Result<(), Error>
Open a specific exercise.
Sourcepub fn close(&mut self, exercise: &ExerciseDefinition) -> Result<(), Error>
pub fn close(&mut self, exercise: &ExerciseDefinition) -> Result<(), Error>
Close a specific exercise.
Sourcepub fn open_next(&mut self) -> Result<ExerciseDefinition, Error>
pub fn open_next(&mut self) -> Result<ExerciseDefinition, Error>
Open the next exercise, assuming we are going through the workshop-runner in order.
Sourcepub fn exercises_dir(&self) -> &Path
pub fn exercises_dir(&self) -> &Path
The directory containing all the workshop chapters and workshop-runner.
Sourcepub fn iter(&self) -> impl Iterator<Item = &ExerciseDefinition>
pub fn iter(&self) -> impl Iterator<Item = &ExerciseDefinition>
Iterate over the workshop-runner in the collection, in the order we expect them to be completed. It returns both opened and unopened workshop-runner.
Auto Trait Implementations§
impl !Freeze for ExerciseCollection
impl !RefUnwindSafe for ExerciseCollection
impl Send for ExerciseCollection
impl !Sync for ExerciseCollection
impl Unpin for ExerciseCollection
impl !UnwindSafe for ExerciseCollection
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