Chris Morgan
›
Git
›
anymap
› commitdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
patch
| inline |
side by side
(parent:
6daea53
)
commit
grep
author
committer
pickaxe
?
search:
re
Add contains method for checking if a type is already in the map.
author
Jonathan Reem
<jonathan.reem@gmail.com>
Thu, 14 Aug 2014 04:01:19 +0000
committer
Jonathan Reem
<jonathan.reem@gmail.com>
Thu, 14 Aug 2014 04:01:19 +0000
src/lib.rs
patch
|
blob
|
history
diff --git
a/src/lib.rs
b/src/lib.rs
index 1fae987a0931e41530dd3de0829607ced2c54416..0c71e367ab39814bb219a547cce50ef7bdc46a9e 100644
(file)
--- a/
src/lib.rs
+++ b/
src/lib.rs
@@
-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 {