Add mem and obj modules, move to nightly
* mem and obj modules are roughly divided between doing memory-specific things and object-specific things * Box::new_uninit() is a nightly feature and it's quite useful, so I'm enabling that for now * Check out src/obj/attrs.rs for possible undefined behavior in the Attrs::new() function. I'm sure it'll be just fine. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
44
src/obj/mod.rs
Normal file
44
src/obj/mod.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
pub mod attrs;
|
||||
pub mod ctx;
|
||||
pub mod dict;
|
||||
pub mod error;
|
||||
//pub mod native_fun;
|
||||
//pub mod num;
|
||||
pub mod str;
|
||||
pub mod sym {
|
||||
pub type Sym = usize;
|
||||
}
|
||||
//pub mod ty;
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{
|
||||
obj::{
|
||||
Attrs, Dict, DictRef, Str, StrRef, Sym, ObjCtx, Obj,
|
||||
},
|
||||
mem::{
|
||||
ptr::{ObjRef, DynRef},
|
||||
intern::Intern,
|
||||
gc::Gc,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub use self::{
|
||||
attrs::Attrs,
|
||||
dict::{Dict, DictRef},
|
||||
ctx::ObjCtx,
|
||||
str::{Str, StrRef},
|
||||
sym::Sym,
|
||||
};
|
||||
use crate::mem::ptr::ObjRef;
|
||||
use std::any::Any;
|
||||
|
||||
pub trait Obj {
|
||||
fn attrs(&self) -> ObjRef<Attrs>;
|
||||
|
||||
fn is_marked(&self) -> bool;
|
||||
fn mark(&self);
|
||||
fn unmark(&self);
|
||||
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
}
|
||||
Reference in New Issue
Block a user