From 84b7317380f6a2fe5996891596e4bc45c8c1d75f Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Wed, 23 Mar 2022 20:22:37 +0000 Subject: [PATCH] Rename get_location to location --- agb/src/hash_map.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/agb/src/hash_map.rs b/agb/src/hash_map.rs index e4688be9..7254e9cc 100644 --- a/agb/src/hash_map.rs +++ b/agb/src/hash_map.rs @@ -206,7 +206,7 @@ where pub fn insert(&mut self, key: K, value: V) -> Option { let hash = self.hash(&key); - if let Some(location) = self.nodes.get_location(&key, hash) { + if let Some(location) = self.nodes.location(&key, hash) { Some(self.nodes.replace_at_location(location, key, value)) } else { if self.nodes.capacity() * 85 / 100 <= self.len() { @@ -222,7 +222,7 @@ where fn insert_and_get(&mut self, key: K, value: V) -> &'_ mut V { let hash = self.hash(&key); - let location = if let Some(location) = self.nodes.get_location(&key, hash) { + let location = if let Some(location) = self.nodes.location(&key, hash) { self.nodes.replace_at_location(location, key, value); location } else { @@ -239,7 +239,7 @@ where /// Returns `true` if the map contains a value for the specified key. pub fn contains_key(&self, k: &K) -> bool { let hash = self.hash(k); - self.nodes.get_location(k, hash).is_some() + self.nodes.location(k, hash).is_some() } /// Returns the key-value pair corresponding to the supplied key @@ -247,7 +247,7 @@ where let hash = self.hash(key); self.nodes - .get_location(key, hash) + .location(key, hash) .and_then(|location| self.nodes.nodes[location].key_value_ref()) } @@ -262,7 +262,7 @@ where pub fn get_mut(&mut self, key: &K) -> Option<&mut V> { let hash = self.hash(key); - if let Some(location) = self.nodes.get_location(key, hash) { + if let Some(location) = self.nodes.location(key, hash) { self.nodes.nodes[location].value_mut() } else { None @@ -275,7 +275,7 @@ where let hash = self.hash(key); self.nodes - .get_location(key, hash) + .location(key, hash) .map(|location| self.nodes.remove_from_location(location)) } } @@ -504,7 +504,7 @@ where /// Gets the given key's corresponding entry in the map for in-place manipulation. pub fn entry(&mut self, key: K) -> Entry<'_, K, V> { let hash = self.hash(&key); - let location = self.nodes.get_location(&key, hash); + let location = self.nodes.location(&key, hash); if let Some(location) = location { Entry::Occupied(OccupiedEntry { @@ -653,7 +653,7 @@ impl NodeStorage { } } - fn get_location(&self, key: &K, hash: HashType) -> Option + fn location(&self, key: &K, hash: HashType) -> Option where K: Eq, {