use crate::{gc::Gc, DiatomValue, IoWrite};
pub struct State<'a, Buffer: IoWrite> {
pub(crate) gc: &'a mut Gc<Buffer>,
}
impl<'a, Buffer: IoWrite> State<'a, Buffer> {
pub fn get_string_by_id(&self, id: usize) -> Option<&str> {
self.gc.get_str(id)
}
pub fn create_str(&mut self, s: String) -> usize {
self.gc.alloc_str(s)
}
pub fn get_obj_mut(&mut self, _ref_id: usize) -> Option<&mut DiatomObject> {
todo!()
}
pub fn get_obj(&mut self, _ref_id: usize) -> Option<&DiatomObject> {
todo!()
}
pub fn print(&self, value: &DiatomValue) -> String {
self.gc.print(value)
}
}
pub enum DiatomObject {
Closure,
Table,
Tuple,
}