pub struct Lesson {
pub lesson_name: LessonId,
pub language: Language,
pub exercise: Exercise,
pub checks: Vec<String>,
pub packages: Vec<String>,
pub description: Option<String>,
pub textbook_reference: Option<String>,
}Expand description
A single lesson: its identity, language, and exercise, with optional prose.
Construct one only through Lesson::parse — a value of this type is, by
construction, structurally complete and semantically valid (ADR-0003).
Fields§
§lesson_name: LessonIdThe lesson’s identity (v1: its name). Required.
language: LanguageThe language the lesson is authored in. Required.
exercise: ExerciseThe exercise the lesson poses. Required.
checks: Vec<String>Executable check code-strings, run against a submission in the lesson’s
language to grade it (Slice 9). A Vec defaulting to empty, not an
Option<Vec>: “no checks” is just the empty list, so there is no
redundant null state forcing absence-handling downstream (§1.1). A lesson
graded by the LLM alone (the R package’s model) therefore needs no
checks key, and every existing lesson stays valid.
packages: Vec<String>Third-party packages the lesson’s code depends on (e.g. pandas,
purrr). A Vec defaulting to empty, not an Option<Vec>: “no
packages” is just the empty list, mirroring checks (§1.1). A lesson
with no packages key stays valid; the browser runner receives an
empty array and the local Python runner spawns uv run with no
--with flags (ADR-0011).
description: Option<String>Optional one-line summary.
textbook_reference: Option<String>Optional pointer to a textbook section.
Implementations§
Source§impl Lesson
impl Lesson
Sourcepub fn parse(yaml: &str) -> Result<Lesson, ValidationError>
pub fn parse(yaml: &str) -> Result<Lesson, ValidationError>
Parse a lesson from a YAML document.
The pure parse boundary (§2.1, §1.3.1): it deserializes the document into
the typed model — a missing required field or wrong type yields
ValidationError::Parse naming the field — then runs
validate_semantics for the rules structure
alone cannot express. Returns a Lesson only if both succeed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Lesson
impl<'de> Deserialize<'de> for Lesson
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 Lesson
impl StructuralPartialEq for Lesson
Auto Trait Implementations§
impl Freeze for Lesson
impl RefUnwindSafe for Lesson
impl Send for Lesson
impl Sync for Lesson
impl Unpin for Lesson
impl UnwindSafe for Lesson
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.