Struct ExerciseCollection

Source
pub struct ExerciseCollection { /* private fields */ }

Implementations§

Source§

impl ExerciseCollection

Source

pub fn new(exercises_dir: PathBuf) -> Result<Self, Error>

Source

pub fn n_opened(&self) -> Result<usize, Error>

Source

pub fn opened(&self) -> Result<BTreeSet<OpenedExercise>, Error>

Return an iterator over all the workshop-runner that have been opened.

Source

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.

Source

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.

Source

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.

Source

pub fn open(&mut self, exercise: &ExerciseDefinition) -> Result<(), Error>

Open a specific exercise.

Source

pub fn close(&mut self, exercise: &ExerciseDefinition) -> Result<(), Error>

Close a specific exercise.

Source

pub fn open_next(&mut self) -> Result<ExerciseDefinition, Error>

Open the next exercise, assuming we are going through the workshop-runner in order.

Source

pub fn exercises_dir(&self) -> &Path

The directory containing all the workshop chapters and workshop-runner.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.