aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_arena
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_arena')
-rw-r--r--crates/ra_arena/src/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_arena/src/lib.rs b/crates/ra_arena/src/lib.rs
index 3ec8d3b60..984e1eec3 100644
--- a/crates/ra_arena/src/lib.rs
+++ b/crates/ra_arena/src/lib.rs
@@ -37,7 +37,7 @@ impl fmt::Display for RawId {
37} 37}
38 38
39#[derive(Clone, PartialEq, Eq)] 39#[derive(Clone, PartialEq, Eq)]
40pub struct Arena<ID: ArenaId, T> { 40pub struct Arena<ID, T> {
41 data: Vec<T>, 41 data: Vec<T>,
42 _ty: PhantomData<ID>, 42 _ty: PhantomData<ID>,
43} 43}
@@ -67,6 +67,12 @@ pub trait ArenaId {
67 fn into_raw(self) -> RawId; 67 fn into_raw(self) -> RawId;
68} 68}
69 69
70impl<ID, T> Arena<ID, T> {
71 pub const fn new() -> Arena<ID, T> {
72 Arena { data: Vec::new(), _ty: PhantomData }
73 }
74}
75
70impl<ID: ArenaId, T> Arena<ID, T> { 76impl<ID: ArenaId, T> Arena<ID, T> {
71 pub fn len(&self) -> usize { 77 pub fn len(&self) -> usize {
72 self.data.len() 78 self.data.len()