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:
26
src/obj/ctx.rs
Normal file
26
src/obj/ctx.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use crate::mem::{gc::Gc, BasicGc};
|
||||
|
||||
pub type DefaultGc = BasicGc;
|
||||
|
||||
pub struct ObjCtx<G=DefaultGc>
|
||||
where
|
||||
G: Gc,
|
||||
{
|
||||
gc: G,
|
||||
}
|
||||
|
||||
impl<G> ObjCtx<G>
|
||||
where
|
||||
G: Gc,
|
||||
{
|
||||
pub fn new(gc: G) -> Self {
|
||||
ObjCtx { gc }
|
||||
}
|
||||
|
||||
pub fn gc(&self) -> &G {
|
||||
&self.gc
|
||||
}
|
||||
pub fn gc_mut(&mut self) -> &mut G {
|
||||
&mut self.gc
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user