use crate::{Alloc, Gc};
pub mod roots;
mod trace_impls;
pub trait TracingAllocator {
type Tracer<'a>: 'a + Tracer<'a, Self>;
}
pub trait Trace<A: TracingAllocator> {
fn trace(&self, tracer: &mut A::Tracer<'_>);
fn trace_slice(data: &[Self], tracer: &mut A::Tracer<'_>)
where
Self: Sized,
{
for item in data {
item.trace(tracer);
}
}
}
pub trait Tracer<'a, A: ?Sized>: Sized
where
A: TracingAllocator<Tracer<'a> = Self>,
{
fn trace_obj<T: ?Sized + Trace<A>>(&mut self, obj: &Gc<T, A>)
where
A: Alloc<T>;
}