pub struct Playground { /* private fields */ }Expand description
A real practice directory with a tracked working directory per session.
Implementations§
Source§impl Playground
impl Playground
Sourcepub fn open_with_display(
root: PathBuf,
display: impl Into<String>,
) -> Result<Self>
pub fn open_with_display( root: PathBuf, display: impl Into<String>, ) -> Result<Self>
Open a playground whose paths are shown to the learner under
display (e.g. ~/ArcAcademy/home).
Sourcepub fn has_lesson(&self) -> bool
pub fn has_lesson(&self) -> bool
Whether a lesson directory is currently active.
Sourcepub fn display_cwd(&self) -> String
pub fn display_cwd(&self) -> String
Friendly display path for the tracked cwd, e.g.
~/ArcAcademy/playground/file-mgmt/practice.
Sourcepub fn enter_lesson(
&mut self,
lesson_id: &str,
setup: &[SetupFile],
) -> Result<PathBuf>
pub fn enter_lesson( &mut self, lesson_id: &str, setup: &[SetupFile], ) -> Result<PathBuf>
Enter a lesson: create <root>/<lesson-id>/, materialize its starter
files (without clobbering files the learner already changed), and cd
there. Returns the lesson directory.
Sourcepub fn reset_lesson(&mut self) -> Result<PathBuf>
pub fn reset_lesson(&mut self) -> Result<PathBuf>
Wipe and re-materialize the active lesson’s playground directory.
rm safety: only ever deletes inside the playground root — the target is canonicalized and its prefix verified before removal.
Sourcepub fn change_directory(&mut self, target: &str) -> Result<String>
pub fn change_directory(&mut self, target: &str) -> Result<String>
Change the tracked working directory (the cd builtin for real
practice mode). The target is canonicalized and must remain inside
the playground. Returns the new display path.