Updated everything and moved to hard tab indentation
This commit is contained in:
@@ -7,25 +7,25 @@ use orchid_base::name::PathSlice;
|
||||
use crate::api;
|
||||
|
||||
pub trait VirtFS: Send + Sync + 'static {
|
||||
fn load(&self, path: &PathSlice) -> api::OrcResult<api::Loaded>;
|
||||
fn load(&self, path: &PathSlice) -> api::OrcResult<api::Loaded>;
|
||||
}
|
||||
|
||||
pub enum DeclFs {
|
||||
Lazy(&'static dyn VirtFS),
|
||||
Mod(&'static [(&'static str, DeclFs)]),
|
||||
Lazy(&'static dyn VirtFS),
|
||||
Mod(&'static [(&'static str, DeclFs)]),
|
||||
}
|
||||
impl DeclFs {
|
||||
pub fn to_api_rec(&self, vfses: &mut HashMap<api::VfsId, &'static dyn VirtFS>) -> api::EagerVfs {
|
||||
match self {
|
||||
DeclFs::Lazy(fs) => {
|
||||
let vfsc: u16 = vfses.len().try_into().expect("too many vfses (more than u16::MAX)");
|
||||
let id = api::VfsId(NonZero::new(vfsc + 1).unwrap());
|
||||
vfses.insert(id, *fs);
|
||||
api::EagerVfs::Lazy(id)
|
||||
},
|
||||
DeclFs::Mod(children) => api::EagerVfs::Eager(
|
||||
children.iter().map(|(k, v)| (intern(*k).to_api(), v.to_api_rec(vfses))).collect(),
|
||||
),
|
||||
}
|
||||
}
|
||||
pub fn to_api_rec(&self, vfses: &mut HashMap<api::VfsId, &'static dyn VirtFS>) -> api::EagerVfs {
|
||||
match self {
|
||||
DeclFs::Lazy(fs) => {
|
||||
let vfsc: u16 = vfses.len().try_into().expect("too many vfses (more than u16::MAX)");
|
||||
let id = api::VfsId(NonZero::new(vfsc + 1).unwrap());
|
||||
vfses.insert(id, *fs);
|
||||
api::EagerVfs::Lazy(id)
|
||||
},
|
||||
DeclFs::Mod(children) => api::EagerVfs::Eager(
|
||||
children.iter().map(|(k, v)| (intern(*k).to_api(), v.to_api_rec(vfses))).collect(),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user