23 lines
682 B
Rust
23 lines
682 B
Rust
use crate::types::script_type::ScriptType;
|
|
use std::collections::HashMap;
|
|
|
|
pub struct ScriptTypeNamespace {
|
|
types: HashMap<String, ScriptType>,
|
|
namespaces: HashMap<String, Box<ScriptTypeNamespace>>,
|
|
root_namespace: Option<Box<ScriptTypeNamespace>>,
|
|
}
|
|
|
|
impl ScriptTypeNamespace {
|
|
pub fn new<'b>(root: Option<Box<ScriptTypeNamespace>>) -> ScriptTypeNamespace {
|
|
ScriptTypeNamespace {
|
|
types: HashMap::new(),
|
|
namespaces: HashMap::new(),
|
|
root_namespace: root,
|
|
}
|
|
}
|
|
|
|
pub fn register(&mut self, identifier: &String, script_type: ScriptType) {
|
|
self.types.insert(identifier.to_string(), script_type);
|
|
}
|
|
}
|