mod load; mod magic; mod symbol; mod write; use crate::vm::function::DvmFunction; use crate::vm::implementation::DvmImplementation; use crate::vm::interface::DvmInterface; use std::rc::Rc; pub struct DmLib { name: String, constants: Vec, interfaces: Vec>, implementations: Vec>, functions: Vec>, } impl DmLib { pub fn new(name: &str) -> DmLib { DmLib { name: name.to_string(), constants: Vec::new(), interfaces: Vec::new(), implementations: Vec::new(), functions: Vec::new(), } } pub fn name(&self) -> &str { &self.name } pub fn constants(&self) -> &Vec { &self.constants } pub fn add_constant(&mut self, constant: DmConstant) { self.constants.push(constant); } pub fn interfaces(&self) -> &Vec> { &self.interfaces } pub fn add_interface(&mut self, interface: DvmInterface) { self.interfaces.push(Rc::new(interface)); } pub fn implementations(&self) -> &Vec> { &self.implementations } pub fn add_implementation(&mut self, implementation: DvmImplementation) { self.implementations.push(Rc::new(implementation)); } pub fn functions(&self) -> &Vec> { &self.functions } pub fn add_function(&mut self, function: DvmFunction) { self.functions.push(Rc::new(function)); } } #[derive(Debug)] pub enum DmConstant { String(String), }