diff --git a/src/lib.rs b/src/lib.rs index 1fae987..0c71e36 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -141,6 +141,11 @@ impl AnyMap { pub fn remove(&mut self) { self.data.remove(&TypeId::of::()); } + + /// Does a value of type `T` exist? + pub fn contains(&self) -> bool { + self.data.contains_key(&TypeId::of::()) + } } impl Collection for AnyMap {