mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 17:53:56 +00:00
Add is_empty to Arena
This commit is contained in:
parent
47f10fce8a
commit
4251f083b5
@ -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 New Issue
Block a user