about summary refs log tree commit diff
path: root/src/libstd/collections/hash
diff options
context:
space:
mode:
authorAlexis Beingessner <a.beingessner@gmail.com>2015-03-20 13:43:01 -0400
committerAlexis <a.beingessner@gmail.com>2015-03-27 07:42:03 -0400
commit1b98f6da7af8cea31066588776b7190c511455b1 (patch)
tree59e9a6e2b8803eea091517ba75cfea54e59faa6f /src/libstd/collections/hash
parent93cdf1f2783e3a863929a5ef2032e7de752e4e40 (diff)
downloadrust-1b98f6da7af8cea31066588776b7190c511455b1.tar.gz
rust-1b98f6da7af8cea31066588776b7190c511455b1.zip
default => or_insert per RFC
Diffstat (limited to 'src/libstd/collections/hash')
-rw-r--r--src/libstd/collections/hash/map.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index b3557529a66..91225891338 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -1489,7 +1489,8 @@ impl<'a, K, V> Entry<'a, K, V> {
     #[unstable(feature = "std_misc",
                reason = "will soon be replaced by or_insert")]
     #[deprecated(since = "1.0",
-                reason = "replaced with more ergonomic `default` and `default_with`")]
+                reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")]
+    /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
     pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> {
         match self {
             Occupied(entry) => Ok(entry.into_mut()),
@@ -1501,7 +1502,7 @@ impl<'a, K, V> Entry<'a, K, V> {
                reason = "matches entry v3 specification, waiting for dust to settle")]
     /// Ensures a value is in the entry by inserting the default if empty, and returns
     /// a mutable reference to the value in the entry.
-    pub fn default(self, default: V) -> &'a mut V {
+    pub fn or_insert(self, default: V) -> &'a mut V {
         match self {
             Occupied(entry) => entry.into_mut(),
             Vacant(entry) => entry.insert(default),
@@ -1512,7 +1513,7 @@ impl<'a, K, V> Entry<'a, K, V> {
                reason = "matches entry v3 specification, waiting for dust to settle")]
     /// Ensures a value is in the entry by inserting the result of the default function if empty,
     /// and returns a mutable reference to the value in the entry.
-    pub fn default_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
+    pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
         match self {
             Occupied(entry) => entry.into_mut(),
             Vacant(entry) => entry.insert(default()),