feat(xatu): add lint architecture

This commit was merged in pull request #71.
This commit is contained in:
2026-09-18 20:57:39 -04:00
parent d974a46211
commit 11f1eba26f
12 changed files with 359 additions and 12 deletions

33
src/xatu/file_store.rs Normal file
View File

@@ -0,0 +1,33 @@
use std::path::PathBuf;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct FileId(usize);
#[derive(Debug)]
pub struct SourceFile {
pub path: PathBuf,
pub source: String,
}
#[derive(Debug, Default)]
pub struct FileStore {
files: Vec<SourceFile>,
}
impl FileStore {
pub fn add(&mut self, file: SourceFile) -> FileId {
let id = FileId(self.files.len());
self.files.push(file);
id
}
pub fn get(&self, id: FileId) -> &SourceFile {
&self.files[id.0]
}
}
impl From<Vec<SourceFile>> for FileStore {
fn from(files: Vec<SourceFile>) -> Self {
Self { files }
}
}