knave 0.9.4

A small Lisp for humans and agents that infers types and ownership and compiles to readable Rust
Documentation
use std::path::{Path, PathBuf};

use super::terminal::ModuleOfSources;
use crate::source::SourceId;

pub struct PromptModule {
    anchor: SourceId,
    root: PathBuf,
}

impl PromptModule {
    pub const PATH: &str = "<prompt>";

    pub fn new(anchor: SourceId, root: PathBuf) -> Self {
        Self { anchor, root }
    }

    pub fn root(&self) -> &Path {
        &self.root
    }

    pub fn of(&self, inputs: Vec<SourceId>) -> ModuleOfSources {
        let mut sources = vec![self.anchor];
        sources.extend(inputs);
        ModuleOfSources {
            path: PathBuf::from(Self::PATH),
            root: self.root.clone(),
            sources,
        }
    }
}