52 lines
969 B
Rust
52 lines
969 B
Rust
pub mod attrs;
|
|
pub mod ctx;
|
|
pub mod dict;
|
|
pub mod error;
|
|
pub mod fun;
|
|
//pub mod num;
|
|
pub mod ns {
|
|
use crate::{mem::ptr::DynRef, obj::Sym};
|
|
use std::collections::BTreeMap;
|
|
|
|
/// A namespace
|
|
pub type Ns = BTreeMap<Sym, DynRef>;
|
|
}
|
|
pub mod str;
|
|
pub mod sym {
|
|
pub type Sym = usize;
|
|
}
|
|
//pub mod ty;
|
|
|
|
pub mod prelude {
|
|
pub use crate::{
|
|
mem::{
|
|
gc::Gc,
|
|
intern::Intern,
|
|
ptr::{DynRef, ObjRef},
|
|
},
|
|
obj::{Attrs, AttrsRef, Dict, DictRef, Fun, NativeFun, Ns, Obj, ObjCtx, Str, StrRef, Sym},
|
|
};
|
|
}
|
|
|
|
pub use self::{
|
|
attrs::{Attrs, AttrsBuilder, AttrsRef},
|
|
ctx::ObjCtx,
|
|
dict::{Dict, DictRef},
|
|
fun::{Fun, NativeFun},
|
|
ns::Ns,
|
|
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;
|
|
}
|