mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Add is_empty to Arena
This commit is contained in:
parent
47f10fce8a
commit
4251f083b5
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue