mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-21 13:14:41 +01:00
lang: work on some basics
This commit is contained in:
parent
1e0741e600
commit
dc44244e7b
|
@ -1,5 +1,7 @@
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
use self::files::{Files, OpenFileError};
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
mod files;
|
mod files;
|
||||||
|
|
||||||
|
@ -7,8 +9,19 @@ struct World;
|
||||||
|
|
||||||
impl World {
|
impl World {
|
||||||
pub fn new(entry_point: &Path) -> Result<Self, WorldCreationError> {
|
pub fn new(entry_point: &Path) -> Result<Self, WorldCreationError> {
|
||||||
|
let mut files = Files::default();
|
||||||
|
let (entry_point_id, errors) = files.add_file(entry_point)?;
|
||||||
|
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum WorldCreationError {}
|
enum WorldCreationError {
|
||||||
|
FailedToOpenEntryPoint(OpenFileError),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<OpenFileError> for WorldCreationError {
|
||||||
|
fn from(value: OpenFileError) -> Self {
|
||||||
|
Self::FailedToOpenEntryPoint(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ use crate::{
|
||||||
world::{error::Error, files::source_file::SourceFile},
|
world::{error::Error, files::source_file::SourceFile},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Files {
|
#[derive(Default)]
|
||||||
|
pub struct Files {
|
||||||
inner: Vec<source_file::SourceFile>,
|
inner: Vec<source_file::SourceFile>,
|
||||||
path_to_id_map: HashMap<PathBuf, FileId>,
|
path_to_id_map: HashMap<PathBuf, FileId>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue