forked from AbleOS/ableos
36 lines
734 B
Rust
36 lines
734 B
Rust
use alloc::{vec, vec::Vec};
|
|
|
|
use spin::{Lazy, Mutex};
|
|
|
|
pub enum Object{
|
|
Raw(xml::XMLElement)
|
|
}
|
|
|
|
pub fn dump(o: Object) -> xml::XMLElement{
|
|
match o{
|
|
Object::Raw(x) => {
|
|
let mut e = xml::XMLElement::new("akern-internal-raw");
|
|
e.children.push(x);
|
|
return e;
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn restore(x: xml::XMLElement) -> Option<Object>{
|
|
let s: &str = &x.name;
|
|
match s{
|
|
"akern-internal-raw" => {
|
|
let f = x.children.get(0)?;
|
|
return Some(Object::Raw(f.clone()))
|
|
}
|
|
_ => None
|
|
}
|
|
}
|
|
|
|
pub type HostObjects = Vec<Option<Object>>;
|
|
|
|
pub const OBJECTS: Lazy<Mutex<HostObjects>> = Lazy::new(|| {
|
|
let mut obj = vec![];
|
|
Mutex::new(obj)
|
|
});
|