Skip to main content

Lesson

Struct Lesson 

Source
pub struct Lesson {
    pub id: String,
    pub title: String,
    pub description: String,
    pub difficulty: Difficulty,
    pub estimated_minutes: u32,
    pub steps: Vec<LessonStep>,
    pub prerequisites: Vec<String>,
    pub tags: Vec<String>,
    pub setup: Vec<SetupFile>,
}
Expand description

A complete lesson module (e.g., “Navigation Basics”)

§TOML lesson-pack format

Lessons can be authored as *.toml files (loaded from ~/.config/arct/lessons/ via LessonLibrary::load_from_dir). The top-level fields map 1:1 onto this struct:

id = "my-lesson"
title = "My Lesson"
description = "What this lesson teaches."
difficulty = "Beginner"          # Beginner | Intermediate | Advanced | Expert
estimated_minutes = 10
prerequisites = ["nav-basics"]   # lesson ids to complete first
tags = ["beginner", "files"]

# Optional starter files, materialized into the practice environment
# before the lesson starts (omit entirely if the lesson needs none).
# In simulated mode they are seeded into the virtual sandbox filesystem;
# in real practice mode they are written under
# ~/ArcAcademy/playground/<lesson-id>/ and the session cd's there.
# `path` is relative to the lesson's practice directory (subdirectories
# are created as needed; absolute paths and `..` are rejected).
[[setup]]
path = "notes.txt"
contents = "starter content\n"

[[setup]]
path = "logs/server.log"
contents = "line 1\nline 2\n"

[[steps]]
step_number = 1
title = "First step"
instruction = "Type the command..."
hint = "Try 'pwd'"

[steps.step_type.CommandExercise]
expected_command = "pwd"
validation = "CommandOnly"
success_message = "Nice!"

Fields§

§id: String§title: String§description: String§difficulty: Difficulty§estimated_minutes: u32§steps: Vec<LessonStep>§prerequisites: Vec<String>§tags: Vec<String>§setup: Vec<SetupFile>

Optional starter files for the lesson’s practice environment.

Defaults to empty, so existing lesson-pack TOML files without a setup array keep parsing unchanged.

Implementations§

Source§

impl Lesson

Source

pub fn to_toml(&self) -> Result<String>

Serialize this lesson to a TOML document (the on-disk lesson format).

Source

pub fn from_toml(content: &str) -> Result<Self>

Parse a lesson from a TOML document.

Trait Implementations§

Source§

impl Clone for Lesson

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Lesson

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Lesson

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Lesson

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.