Skip to content

Commit c9b40a3

Browse files
committed
std: Stabilize vec_map::Entry::or_insert{,_with}
These functions mirror the other Entry APIs of other maps, and were mistakenly just not stabilized the first time around.
1 parent edf9335 commit c9b40a3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/libcollections/vec_map.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,21 +646,20 @@ impl<'a, V> Entry<'a, V> {
646646
}
647647
}
648648

649-
#[unstable(feature = "entry",
650-
reason = "matches entry v3 specification, waiting for dust to settle")]
651-
/// Ensures a value is in the entry by inserting the default if empty, and returns
652-
/// a mutable reference to the value in the entry.
649+
#[stable(feature = "vecmap_entry", since = "1.2.0")]
650+
/// Ensures a value is in the entry by inserting the default if empty, and
651+
/// returns a mutable reference to the value in the entry.
653652
pub fn or_insert(self, default: V) -> &'a mut V {
654653
match self {
655654
Occupied(entry) => entry.into_mut(),
656655
Vacant(entry) => entry.insert(default),
657656
}
658657
}
659658

660-
#[unstable(feature = "entry",
661-
reason = "matches entry v3 specification, waiting for dust to settle")]
662-
/// Ensures a value is in the entry by inserting the result of the default function if empty,
663-
/// and returns a mutable reference to the value in the entry.
659+
#[stable(feature = "vecmap_entry", since = "1.2.0")]
660+
/// Ensures a value is in the entry by inserting the result of the default
661+
/// function if empty, and returns a mutable reference to the value in the
662+
/// entry.
664663
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
665664
match self {
666665
Occupied(entry) => entry.into_mut(),

0 commit comments

Comments
 (0)