diff options
| author | Vojtech Kral <vojtech@kral.hk> | 2021-04-15 09:33:46 +0200 |
|---|---|---|
| committer | Vojtech Kral <vojtech@kral.hk> | 2021-04-15 23:23:46 +0200 |
| commit | 44be1c2aa0df6ef4ff22e4aa92be3f32daf036a9 (patch) | |
| tree | 0b0e50925e5243fe2e0f770555501e3e3ae3951e /library/alloc/src | |
| parent | e68680d30db3ba492827979b44c9f28e574e2274 (diff) | |
| download | rust-44be1c2aa0df6ef4ff22e4aa92be3f32daf036a9.tar.gz rust-44be1c2aa0df6ef4ff22e4aa92be3f32daf036a9.zip | |
VecDeque: Improve doc comments in binary search fns
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/collections/vec_deque/mod.rs | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index f8516bdab0c..7d6fbf1c438 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -2403,6 +2403,12 @@ impl<T> VecDeque<T> { /// [`Result::Err`] is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. /// + /// See also [`binary_search_by`], [`binary_search_by_key`], and [`partition_point`]. + /// + /// [`binary_search_by`]: VecDeque::binary_search_by + /// [`binary_search_by_key`]: VecDeque::binary_search_by_key + /// [`partition_point`]: VecDeque::partition_point + /// /// # Examples /// /// Looks up a series of four elements. The first is found, with a @@ -2457,6 +2463,12 @@ impl<T> VecDeque<T> { /// [`Result::Err`] is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. /// + /// See also [`binary_search`], [`binary_search_by_key`], and [`partition_point`]. + /// + /// [`binary_search`]: VecDeque::binary_search + /// [`binary_search_by_key`]: VecDeque::binary_search_by_key + /// [`partition_point`]: VecDeque::partition_point + /// /// # Examples /// /// Looks up a series of four elements. The first is found, with a @@ -2495,8 +2507,7 @@ impl<T> VecDeque<T> { /// Binary searches this sorted `VecDeque` with a key extraction function. /// /// Assumes that the `VecDeque` is sorted by the key, for instance with - /// [`make_contiguous().sort_by_key()`](#method.make_contiguous) using the same - /// key extraction function. + /// [`make_contiguous().sort_by_key()`] using the same key extraction function. /// /// If the value is found then [`Result::Ok`] is returned, containing the /// index of the matching element. If there are multiple matches, then any @@ -2504,6 +2515,13 @@ impl<T> VecDeque<T> { /// [`Result::Err`] is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. /// + /// See also [`binary_search`], [`binary_search_by`], and [`partition_point`]. + /// + /// [`make_contiguous().sort_by_key()`]: VecDeque::make_contiguous + /// [`binary_search`]: VecDeque::binary_search + /// [`binary_search_by`]: VecDeque::binary_search_by + /// [`partition_point`]: VecDeque::partition_point + /// /// # Examples /// /// Looks up a series of four elements in a slice of pairs sorted by @@ -2549,9 +2567,9 @@ impl<T> VecDeque<T> { /// /// See also [`binary_search`], [`binary_search_by`], and [`binary_search_by_key`]. /// - /// [`binary_search`]: slice::binary_search - /// [`binary_search_by`]: slice::binary_search_by - /// [`binary_search_by_key`]: slice::binary_search_by_key + /// [`binary_search`]: VecDeque::binary_search + /// [`binary_search_by`]: VecDeque::binary_search_by + /// [`binary_search_by_key`]: VecDeque::binary_search_by_key /// /// # Examples /// |
