Add is_empty to Arena

This commit is contained in:
kjeremy 2019-04-26 11:42:10 -04:00
parent 47f10fce8a
commit 4251f083b5

View File

@ -71,6 +71,9 @@ impl<ID: ArenaId, T> Arena<ID, T> {
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.data.len() self.data.len()
} }
pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
pub fn alloc(&mut self, value: T) -> ID { pub fn alloc(&mut self, value: T) -> ID {
let id = RawId(self.data.len() as u32); let id = RawId(self.data.len() as u32);
self.data.push(value); self.data.push(value);