X-Git-Url: https://git.chrismorgan.info/anymap/blobdiff_plain/8b30c87fe6cf514544d8bc68989631daac8aeec1..7dc36adf24d48394bcb9d0aa802746e3d4a1f564:/src/lib.rs diff --git a/src/lib.rs b/src/lib.rs index f5ee7b3..0c71e36 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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(&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 {