From 10244cfbba53ae2b5a4043c6f3bbd5f3b9ce8886 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Sat, 8 Nov 2014 10:09:21 +1100 Subject: [PATCH] Make trait bounds more explicit. --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e766913..152a397 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,28 +122,28 @@ impl AnyMap { impl AnyMap { /// Retrieve the value stored in the map for the type `T`, if it exists. - pub fn find(&self) -> Option<&T> { + pub fn find(&self) -> Option<&T> { self.data.find(&TypeId::of::()).map(|any| unsafe { any.as_ref_unchecked::() }) } /// Retrieve a mutable reference to the value stored in the map for the type `T`, if it exists. - pub fn find_mut(&mut self) -> Option<&mut T> { + pub fn find_mut(&mut self) -> Option<&mut T> { self.data.find_mut(&TypeId::of::()).map(|any| unsafe { any.as_mut_unchecked::() }) } /// Set the value contained in the map for the type `T`. /// This will override any previous value stored. - pub fn insert(&mut self, value: T) { + pub fn insert(&mut self, value: T) { self.data.insert(TypeId::of::(), box value as Box); } /// Remove the value for the type `T` if it existed. - pub fn remove(&mut self) { + pub fn remove(&mut self) { self.data.remove(&TypeId::of::()); } /// Does a value of type `T` exist? - pub fn contains(&self) -> bool { + pub fn contains(&self) -> bool { self.data.contains_key(&TypeId::of::()) }