mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 08:41:34 +11:00
Rename get_value_ref and get_value_mut to remove get
This commit is contained in:
parent
86760f76ac
commit
e0d829a4fc
|
@ -51,7 +51,7 @@ impl<K, V> Node<K, V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_value_ref(&self) -> Option<&V> {
|
fn value_ref(&self) -> Option<&V> {
|
||||||
if self.has_value() {
|
if self.has_value() {
|
||||||
Some(unsafe { self.value.assume_init_ref() })
|
Some(unsafe { self.value.assume_init_ref() })
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,7 +59,7 @@ impl<K, V> Node<K, V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_value_mut(&mut self) -> Option<&mut V> {
|
fn value_mut(&mut self) -> Option<&mut V> {
|
||||||
if self.has_value() {
|
if self.has_value() {
|
||||||
Some(unsafe { self.value.assume_init_mut() })
|
Some(unsafe { self.value.assume_init_mut() })
|
||||||
} else {
|
} else {
|
||||||
|
@ -310,14 +310,14 @@ where
|
||||||
|
|
||||||
self.nodes
|
self.nodes
|
||||||
.get_location(key, hash)
|
.get_location(key, hash)
|
||||||
.and_then(|location| self.nodes.nodes[location].get_value_ref())
|
.and_then(|location| self.nodes.nodes[location].value_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_mut(&mut self, key: &K) -> Option<&mut V> {
|
pub fn get_mut(&mut self, key: &K) -> Option<&mut V> {
|
||||||
let hash = self.hash(key);
|
let hash = self.hash(key);
|
||||||
|
|
||||||
if let Some(location) = self.nodes.get_location(key, hash) {
|
if let Some(location) = self.nodes.get_location(key, hash) {
|
||||||
self.nodes.nodes[location].get_value_mut()
|
self.nodes.nodes[location].value_mut()
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
|
||||||
self.at += 1;
|
self.at += 1;
|
||||||
|
|
||||||
if node.has_value() {
|
if node.has_value() {
|
||||||
return Some((node.key_ref().unwrap(), node.get_value_ref().unwrap()));
|
return Some((node.key_ref().unwrap(), node.value_ref().unwrap()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ where
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
Entry::Occupied(e) => {
|
Entry::Occupied(e) => {
|
||||||
f(e.entry.get_value_mut().unwrap());
|
f(e.entry.value_mut().unwrap());
|
||||||
Entry::Occupied(e)
|
Entry::Occupied(e)
|
||||||
}
|
}
|
||||||
Entry::Vacant(e) => Entry::Vacant(e),
|
Entry::Vacant(e) => Entry::Vacant(e),
|
||||||
|
|
Loading…
Reference in a new issue