pub struct Exercise {
pub prompt: String,
pub llm_evaluation_prompt: String,
pub kind: Option<ExerciseKind>,
pub code_template: Option<String>,
pub solution: Option<String>,
pub hints: Option<String>,
pub gotchas: Option<String>,
pub example_usage: Option<String>,
pub success_criteria: Option<String>,
}Expand description
The exercise a lesson poses.
The two required prompts carry the learner-facing task and the grading
template; the optional fields are authoring aids. llm_evaluation_prompt
must contain the {student_code} placeholder — enforced by Lesson::parse,
not by this type alone. Unknown keys are rejected (§1.3.1) so an author’s
typo in an optional field surfaces rather than silently dropping to None.
Fields§
§prompt: StringWhat the learner is asked to do. Required.
llm_evaluation_prompt: StringThe prompt sent to the LLM to grade a submission. Required; must contain
the {student_code} placeholder.
kind: Option<ExerciseKind>The kind of exercise, from the YAML type key. Optional.
code_template: Option<String>Optional starter code shown to the learner.
solution: Option<String>Optional reference solution: a known-correct answer to the exercise. The
static-site build serializes it into the lesson JSON so the in-browser
runner can self-verify a correct submission (ADR-0008). It is authoring
data, never sent to the LLM; Option so every existing lesson stays valid.
hints: Option<String>Optional learner-facing hints: tips and guidance, authored as a Markdown
bullet list (each non-empty line starts with - or * ). The
static-site build serializes them into the lesson JSON so the
in-browser runner renders them in an expandable <details> panel.
Option so every existing lesson stays valid; validated as bullets at
the parse boundary (§1.3.1) so malformed content never travels
downstream. Option defaults to None without #[serde(default)].
gotchas: Option<String>Optional learner-facing gotchas: common pitfalls and mistakes, authored
as a Markdown bullet list (each non-empty line starts with - or
* ). The static-site build serializes them into the lesson JSON so the
in-browser runner renders them in an expandable <details> panel.
Option so every existing lesson stays valid; validated as bullets at
the parse boundary (§1.3.1) so malformed content never travels
downstream. Option defaults to None without #[serde(default)].
example_usage: Option<String>Optional example invocations.
success_criteria: Option<String>Optional human-readable success criteria.
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>,
impl Eq for Exercise
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.