pub struct Course { /* private fields */ }Expand description
A course directory: its root and parsed manifest.
Construct one through Course::open; a value of this type has, by
construction, a manifest that parsed.
Implementations§
Source§impl Course
impl Course
Sourcepub fn open(dir: &Path) -> Result<Course, ManifestError>
pub fn open(dir: &Path) -> Result<Course, ManifestError>
Open the course rooted at dir by reading and parsing its
blendtutor.toml.
The effectful shell (§2.2) over the pure Manifest::parse. A missing or
malformed manifest is a whole-course failure (ADR-0004) — distinct from a
single bad lesson, which discover reports as a row.
Sourcepub fn discover(&self) -> Vec<Result<LessonSummary, DiscoveryError>>
pub fn discover(&self) -> Vec<Result<LessonSummary, DiscoveryError>>
Discover every lesson the manifest lists, one row per entry.
Each entry yields Ok(LessonSummary) if its lesson loads and validates,
or Err(DiscoveryError) carrying the entry’s slug if it does not — so a
malformed lesson neither aborts the scan nor disappears (ADR-0004, §1.2).
The per-lesson read is effectful; the summarize it feeds is pure
(§2.1, §2.2), depending on crate::lesson in one direction (§3.1).
Sourcepub fn load_lessons(&self) -> Result<Vec<(LessonSlug, Lesson)>, DiscoveryError>
pub fn load_lessons(&self) -> Result<Vec<(LessonSlug, Lesson)>, DiscoveryError>
Load every lesson the manifest lists, in full and in author order.
The effectful loader the static-site build needs (ADR-0008). Unlike
discover — which tolerates a partial failure by
returning one row per entry — this short-circuits on the first lesson that
fails to load: a site cannot be built from a course with a broken lesson,
so the whole build fails rather than emitting a site that silently drops a
page. Each entry pairs the manifest slug with its parsed Lesson.
Sourcepub fn site_config(&self) -> Option<&SiteConfig>
pub fn site_config(&self) -> Option<&SiteConfig>
The site-level configuration from the manifest’s [site] section, if
present. Returns None when the course has no [site] section; the
caller applies SiteConfig::default (max=20) in that case.