Tidy, tidy, tidy.

This commit is contained in:
2025-11-05 21:30:03 -08:00
parent 7bd242a641
commit 05d7284551
8 changed files with 723 additions and 537 deletions

View File

@@ -6,21 +6,17 @@ use memmap2::Mmap;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
#[derive(Default)]
pub struct Universe {
pub files: HashMap<PathBuf, Mmap>,
pub modules: HashMap<PathBuf, Module>,
}
impl Default for Universe {
fn default() -> Self {
Universe {
files: HashMap::new(),
modules: HashMap::new(),
}
}
}
impl Universe {
/// Add a file to this universe.
///
/// This may result in other files being loaded on behalf of the file, if
/// (for example) the given file has imports.
pub fn add_file<P: AsRef<Path>>(&mut self, file: P) -> Result<(), ParserError> {
let filename = file.as_ref().to_string_lossy().into_owned();