Use EntityMap instead of BTreeMap

This commit is contained in:
Morgan Phillips
2016-07-21 12:08:02 -07:00
parent 89ba9626c7
commit 2caa802f50
2 changed files with 53 additions and 25 deletions

View File

@@ -46,6 +46,7 @@ pub trait EntityRef: Copy + Eq {
/// A *secondary* `EntityMap` contains additional data about entities kept in a primary map. The
/// values need to implement `Clone + Default` traits so the map can be grown with `ensure`.
///
#[derive(Debug)]
pub struct EntityMap<K, V>
where K: EntityRef
{
@@ -76,6 +77,10 @@ impl<K, V> EntityMap<K, V>
self.elems.push(v);
k
}
pub fn len(&self) -> usize {
self.elems.len()
}
}
/// Additional methods for value types that implement `Clone` and `Default`.