diff options
Diffstat (limited to 'src/libstd/smallintmap.rs')
| -rw-r--r-- | src/libstd/smallintmap.rs | 24 | 
1 files changed, 12 insertions, 12 deletions
| diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index fffd6c9ee4f..4ad8d38b072 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -108,6 +108,18 @@ impl<V> Map<uint, V> for SmallIntMap<V> { } } + /// Return a mutable reference to the value corresponding to the key + fn find_mut(&mut self, key: &uint) -> Option<&'self mut V> { + if *key < self.v.len() { + match self.v[*key] { + Some(ref mut value) => Some(value), + None => None + } + } else { + None + } + } + /// Insert a key-value pair into the map. An existing value for a /// key is replaced by the new value. Return true if the key did /// not already exist in the map. @@ -140,18 +152,6 @@ pub impl<V> SmallIntMap<V> { fn get(&self, key: &uint) -> &'self V { self.find(key).expect("key not present") } - - /// Return a mutable reference to the value corresponding to the key - fn find_mut(&mut self, key: &uint) -> Option<&'self mut V> { - if *key < self.v.len() { - match self.v[*key] { - Some(ref mut value) => Some(value), - None => None - } - } else { - None - } - } } pub impl<V:Copy> SmallIntMap<V> { | 
