@@ -2378,7 +2378,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
2378
2378
}
2379
2379
2380
2380
/// Binary searches this `VecDeque` for a given element.
2381
- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
2381
+ /// If the `VecDeque` is not sorted, the returned result is unspecified and
2382
+ /// meaningless.
2382
2383
///
2383
2384
/// If the value is found then [`Result::Ok`] is returned, containing the
2384
2385
/// index of the matching element. If there are multiple matches, then any
@@ -2434,12 +2435,13 @@ impl<T, A: Allocator> VecDeque<T, A> {
2434
2435
}
2435
2436
2436
2437
/// Binary searches this `VecDeque` with a comparator function.
2437
- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
2438
2438
///
2439
- /// The comparator function should implement an order consistent
2440
- /// with the sort order of the deque, returning an order code that
2441
- /// indicates whether its argument is `Less`, `Equal` or `Greater`
2442
- /// than the desired target.
2439
+ /// The comparator function should return an order code that indicates
2440
+ /// whether its argument is `Less`, `Equal` or `Greater` the desired
2441
+ /// target.
2442
+ /// If the `VecDeque` is not sorted or if the comparator function does not
2443
+ /// implement an order consistent with the sort order of the underlying
2444
+ /// `VecDeque`, the returned result is unspecified and meaningless.
2443
2445
///
2444
2446
/// If the value is found then [`Result::Ok`] is returned, containing the
2445
2447
/// index of the matching element. If there are multiple matches, then any
@@ -2489,10 +2491,11 @@ impl<T, A: Allocator> VecDeque<T, A> {
2489
2491
}
2490
2492
2491
2493
/// Binary searches this `VecDeque` with a key extraction function.
2492
- /// This behaves similarly to [`contains`] if this `VecDeque` is sorted.
2493
2494
///
2494
2495
/// Assumes that the deque is sorted by the key, for instance with
2495
2496
/// [`make_contiguous().sort_by_key()`] using the same key extraction function.
2497
+ /// If the deque is not sorted by the key, the returned result is
2498
+ /// unspecified and meaningless.
2496
2499
///
2497
2500
/// If the value is found then [`Result::Ok`] is returned, containing the
2498
2501
/// index of the matching element. If there are multiple matches, then any
0 commit comments