Merge pull request #9 from reem/contains
Add contains method for checking if a type is already in the map.
This commit is contained in:
commit
c2473c1fce
|
@ -141,6 +141,11 @@ impl AnyMap {
|
|||
pub fn remove<T: 'static>(&mut self) {
|
||||
self.data.remove(&TypeId::of::<T>());
|
||||
}
|
||||
|
||||
/// Does a value of type `T` exist?
|
||||
pub fn contains<T: 'static>(&self) -> bool {
|
||||
self.data.contains_key(&TypeId::of::<T>())
|
||||
}
|
||||
}
|
||||
|
||||
impl Collection for AnyMap {
|
||||
|
|
Loading…
Reference in a new issue