use arena for sysroot

This commit is contained in:
Aleksey Kladov
2019-01-10 22:47:05 +03:00
parent 66fba88534
commit 8852408bfb
2 changed files with 90 additions and 50 deletions

View File

@@ -35,12 +35,21 @@ impl fmt::Display for RawId {
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq)]
pub struct Arena<ID: ArenaId, T> {
data: Vec<T>,
_ty: PhantomData<ID>,
}
impl<ID: ArenaId, T: fmt::Debug> fmt::Debug for Arena<ID, T> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("Arena")
.field("len", &self.len())
.field("data", &self.data)
.finish()
}
}
#[macro_export]
macro_rules! impl_arena_id {
($name:ident) => {