From 586acef5283e78f19e5e9daf4e8aac40e2a9ff16 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 22:44:24 +0300 Subject: Simplify ADT fields --- crates/ra_arena/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/ra_arena/src') 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 { } #[derive(Clone, PartialEq, Eq)] -pub struct Arena { +pub struct Arena { data: Vec, _ty: PhantomData, } @@ -67,6 +67,12 @@ pub trait ArenaId { fn into_raw(self) -> RawId; } +impl Arena { + pub const fn new() -> Arena { + Arena { data: Vec::new(), _ty: PhantomData } + } +} + impl Arena { pub fn len(&self) -> usize { self.data.len() -- cgit v1.2.3