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:
Chris Morgan 2014-08-14 17:41:46 +10:00
commit c2473c1fce

View file

@ -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 {