pub struct Exercise {
pub id: Option<String>,
pub number: Option<String>,
pub difficulty: Option<Difficulty>,
pub points: Option<u32>,
pub children: Vec<Block>,
pub parts: Vec<ExercisePart>,
pub hints: Vec<Block>,
pub solution: Option<Solution>,
}Expand description
An exercise with optional hints and solutions.
Fields§
§id: Option<String>Optional unique identifier.
number: Option<String>Exercise number.
difficulty: Option<Difficulty>Difficulty level.
points: Option<u32>Points/marks for the exercise.
children: Vec<Block>Exercise statement.
parts: Vec<ExercisePart>Sub-parts of the exercise.
hints: Vec<Block>Hints.
solution: Option<Solution>Solution (may be hidden).
Implementations§
Source§impl Exercise
impl Exercise
Sourcepub fn with_number(self, number: impl Into<String>) -> Self
pub fn with_number(self, number: impl Into<String>) -> Self
Set the number.
Sourcepub fn with_difficulty(self, difficulty: Difficulty) -> Self
pub fn with_difficulty(self, difficulty: Difficulty) -> Self
Set difficulty.
Sourcepub fn with_points(self, points: u32) -> Self
pub fn with_points(self, points: u32) -> Self
Set points.
Sourcepub fn with_part(self, part: ExercisePart) -> Self
pub fn with_part(self, part: ExercisePart) -> Self
Add a part.
Sourcepub fn with_solution(self, solution: Solution) -> Self
pub fn with_solution(self, solution: Solution) -> Self
Set the solution.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Exercise
impl<'de> Deserialize<'de> for Exercise
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Exercise
Auto Trait Implementations§
impl Freeze for Exercise
impl RefUnwindSafe for Exercise
impl Send for Exercise
impl Sync for Exercise
impl Unpin for Exercise
impl UnsafeUnpin for Exercise
impl UnwindSafe for Exercise
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