Skip to content

Commit 264e5b7

Browse files
committed
Add doc aliases like BTreeMap/BTreeSet
1 parent e1f5f26 commit 264e5b7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/map.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ impl<K, V, S> IndexMap<K, V, S> {
821821
/// This preserves the order of the remaining elements.
822822
///
823823
/// Computes in **O(1)** time (average).
824+
#[doc(alias = "pop_last")] // like `BTreeMap`
824825
pub fn pop(&mut self) -> Option<(K, V)> {
825826
self.core.pop()
826827
}
@@ -1087,6 +1088,7 @@ impl<K, V, S> IndexMap<K, V, S> {
10871088
/// Get the first key-value pair
10881089
///
10891090
/// Computes in **O(1)** time.
1091+
#[doc(alias = "first_key_value")] // like `BTreeMap`
10901092
pub fn first(&self) -> Option<(&K, &V)> {
10911093
self.as_entries().first().map(Bucket::refs)
10921094
}
@@ -1108,6 +1110,7 @@ impl<K, V, S> IndexMap<K, V, S> {
11081110
/// Get the last key-value pair
11091111
///
11101112
/// Computes in **O(1)** time.
1113+
#[doc(alias = "last_key_value")] // like `BTreeMap`
11111114
pub fn last(&self) -> Option<(&K, &V)> {
11121115
self.as_entries().last().map(Bucket::refs)
11131116
}

src/set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ impl<T, S> IndexSet<T, S> {
708708
/// This preserves the order of the remaining elements.
709709
///
710710
/// Computes in **O(1)** time (average).
711+
#[doc(alias = "pop_last")] // like `BTreeSet`
711712
pub fn pop(&mut self) -> Option<T> {
712713
self.map.pop().map(|(x, ())| x)
713714
}

0 commit comments

Comments
 (0)