use crate::obj::prelude::*; use shredder::Scan; use std::fmt::{Debug, Formatter, self}; pub type IntRef = ObjRef; #[derive(Scan)] pub struct Int { value: i64, vtable: Vtable, attrs: Attrs, } impl Int { pub fn new_obj(value: i64) -> ObjRef { // TODO : vtable for Int let obj_ref = ObjRef::new(Self { value, vtable: Default::default(), attrs: Default::default(), }); obj_ref } pub fn value(&self) -> i64 { self.value } } impl_obj_readonly!(Int); impl Debug for Int { fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { fmt.debug_struct("Int") .field("value", &self.value) .finish() } }