Ignore Cargo.lock (this is a library).
[anymap] / src / lib.rs
index f5ee7b3831e61945b9e1e85daba10c0e6c1960cc..0c71e367ab39814bb219a547cce50ef7bdc46a9e 100644 (file)
@@ -1,8 +1,7 @@
 //! This crate provides the `AnyMap` type, a safe and convenient store for one value of each type.
 
-#![crate_id = "anymap#0.9.0"]
-#![crate_type = "rlib"]
-#![crate_type = "dylib"]
+#![crate_name = "anymap"]
+#![crate_type = "lib"]
 #![feature(default_type_params)]
 #![warn(unnecessary_qualification, non_uppercase_statics,
         variant_size_difference, managed_heap_memory, unnecessary_typecast,
@@ -142,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 {