Lines Matching refs:range

1512                 black_box(map.range(f(i, j)));
3816 // orthogonally from range types; therefore, it is worth testing
3824 ($s:expr, $range:expr, $expected:expr) => {
3831 assert_eq!(&s[$range], expected, "(in assertion for: index)");
3832 assert_eq!(s.get($range), Some(expected), "(in assertion for: get)");
3835 s.get_unchecked($range),
3845 assert_eq!(&mut s[$range], expected, "(in assertion for: index_mut)",);
3847 s.get_mut($range),
3853 s.get_unchecked_mut($range),
3895 // output str. This helps validate "critical points" where an input range
4143 // it is especially important to test all of the different range types here
5277 panic!("Input skipped range at {}", err);
8262 next_then_drop(v.splice(5.., vec![1, 2, 3, 4, 5])); // empty tail after range
8264 next_then_drop(v.splice(5..8, vec![1])); // replacement is smaller than original range
11327 deq.range((Included(0), Included(usize::MAX)));
11334 deq.range((Excluded(usize::MAX), Included(0)));
17709 /// Creates a draining iterator that removes the specified range in the `String`
17712 /// Note: The element range is removed even if the iterator is not
17728 /// // Remove the range up until the β from the string
17733 /// // A full range clears the string
17738 pub fn drain<R>(&mut self, range: R) -> Drain<'_>
17746 // Because the range removal happens in Drop, if the Drain iterator is leaked,
17748 let Range { start, end } = slice::range(range, ..self.len());
17755 // SAFETY: `slice::range` and `is_char_boundary` do the appropriate bounds checks.
17761 /// Removes the specified range in the string,
17763 /// The given string doesn't need to be the same length as the range.
17778 /// // Replace the range up until the β from the string
17783 pub fn replace_range<R>(&mut self, range: R, replace_with: &str)
17793 let start = range.start_bound();
17800 let end = range.end_bound();
17807 // Using `range` again would be unsound (#81138)
17808 // We assume the bounds reported by `range` remain the same, but
18715 /// Current remaining range to remove
22067 pub use core::slice::range;
22903 // hole in `v` with the unconsumed range in `buf`, thus ensuring that `v` still holds every
22970 // When dropped, copies the range `start..end` into `dest..`.
29586 /// of the range is different from the edge matching the upper bound, i.e.,
29587 /// the nearest node that has at least one key contained in the range.
29590 /// edge indices in the node delimiting the range, and the corresponding
29595 /// range.
29597 /// As a diagnostic service, panics if the range specifies impossible bounds.
29602 range: &'r R,
29618 // Inlining these variables should be avoided. We assume the bounds reported by `range`
29620 let (start, end) = (range.start_bound(), range.end_bound());
29623 panic!("range start and end are equal and excluded in BTreeMap")
29628 panic!("range start is greater than range end in BTreeMap")
29660 /// Finds an edge in the node delimiting the lower bound of a range.
29738 /// Finds an edge index in the node delimiting the lower bound of a range.
30073 range: Range<'a, K, V>,
30093 range: RangeMut<'a, K, V>,
30105 range: LeafRange<marker::Dying, K, V>,
30113 let range = Range { inner: self.range.reborrow() };
30114 Iter { range: range, length: self.length }
30223 /// An iterator over a sub-range of entries in a `BTreeMap`.
30225 /// This `struct` is created by the [`range`] method on [`BTreeMap`]. See its
30228 /// [`range`]: BTreeMap::range
30241 /// A mutable iterator over a sub-range of entries in a `BTreeMap`.
30258 let range = Range { inner: self.inner.reborrow() };
30259 f.debug_list().entries(range).finish()
30802 /// Constructs a double-ended iterator over a sub-range of elements in the map.
30803 /// The simplest way is to use the range syntax `min..max`, thus `range(min..max)` will
30805 /// The range may also be entered as `(Bound<T>, Bound<T>)`, so for example
30806 /// `range((Excluded(4), Included(10)))` will yield a left-exclusive, right-inclusive
30807 /// range from 4 to 10.
30811 /// Panics if range `start > end`.
30812 /// Panics if range `start == end` and both bounds are `Excluded`.
30826 /// for (&key, &value) in map.range((Included(&4), Included(&8))) {
30829 /// assert_eq!(Some((&5, &"b")), map.range(4..).next());
30832 pub fn range<T: ?Sized, R>(&self, range: R) -> Range<'_, K, V>
30839 Range { inner: root.reborrow().range_search(range) }
30845 /// Constructs a mutable double-ended iterator over a sub-range of elements in the map.
30846 /// The simplest way is to use the range syntax `min..max`, thus `range(min..max)` will
30848 /// The range may also be entered as `(Bound<T>, Bound<T>)`, so for example
30849 /// `range((Excluded(4), Included(10)))` will yield a left-exclusive, right-inclusive
30850 /// range from 4 to 10.
30854 /// Panics if range `start > end`.
30855 /// Panics if range `start == end` and both bounds are `Excluded`.
30876 pub fn range_mut<T: ?Sized, R>(&mut self, range: R) -> RangeMut<'_, K, V>
30883 RangeMut { inner: root.borrow_valmut().range_search(range), _marker: PhantomData }
31096 Some(unsafe { self.range.next_unchecked() })
31127 Some(unsafe { self.range.next_back_unchecked() })
31142 Iter { range: self.range.clone(), length: self.length }
31165 Some(unsafe { self.range.next_unchecked() })
31193 Some(unsafe { self.range.next_back_unchecked() })
31212 Iter { range: self.range.iter(), length: self.length }
31226 IntoIter { range: full_range, length: me.length }
31228 IntoIter { range: LeafRange::none(), length: 0 }
31267 if let Some(front) = self.range.front.take() {
31282 Some(unsafe { self.range.front.as_mut().unwrap().deallocating_next_unchecked() })
31298 Some(unsafe { self.range.back.as_mut().unwrap().deallocating_next_back_unchecked() })
31851 Iter { range: Range { inner: full_range }, length: self.length }
31853 Iter { range: Range { inner: LeafRange::none() }, length: 0 }
31884 range: RangeMut { inner: full_range, _marker: PhantomData },
31889 range: RangeMut { inner: LeafRange::none(), _marker: PhantomData },
32276 /// An iterator over a sub-range of items in a `BTreeSet`.
32278 /// This `struct` is created by the [`range`] method on [`BTreeSet`].
32281 /// [`range`]: BTreeSet::range
32414 /// Constructs a double-ended iterator over a sub-range of elements in the set.
32415 /// The simplest way is to use the range syntax `min..max`, thus `range(min..max)` will
32417 /// The range may also be entered as `(Bound<T>, Bound<T>)`, so for example
32418 /// `range((Excluded(4), Included(10)))` will yield a left-exclusive, right-inclusive
32419 /// range from 4 to 10.
32431 /// for &elem in set.range((Included(&4), Included(&8))) {
32434 /// assert_eq!(Some(&5), set.range(4..).next());
32437 pub fn range<K: ?Sized, R>(&self, range: R) -> Range<'_, T>
32443 Range { iter: self.map.range(range) }
33646 // the number of elements to less than half the range of usize.
33769 /// Temporarily takes out another, immutable equivalent of the same range.
33779 /// Finds the distinct leaf edges delimiting a specified range in a tree.
33787 /// the range, returns a pair of empty options.
33794 range: R,
33801 match self.search_tree_for_bifurcation(&range) {
33853 /// Finds the pair of leaf edges delimiting a specific range in a tree.
33857 pub fn range_search<Q, R>(self, range: R) -> LeafRange<marker::Immut<'a>, K, V>
33864 unsafe { self.find_leaf_edges_spanning_range(range) }
33874 /// Splits a unique reference into a pair of leaf edges delimiting a specified range.
33883 pub fn range_search<Q, R>(self, range: R) -> LeafRange<marker::ValMut<'a>, K, V>
33889 unsafe { self.find_leaf_edges_spanning_range(range) }
33892 /// Splits a unique reference into a pair of leaf edges delimiting the full range of the tree.
33904 /// Splits a unique reference into a pair of leaf edges delimiting the full range of the tree.
34317 assert_eq!(a.range(..).min(), None);
34318 assert_eq!(a.range(..).max(), None);
34331 assert_eq!(a.range(..).min(), Some(&1));
34332 assert_eq!(a.range(..).max(), Some(&2));
34819 fn range<'a, 'new>(v: Range<'a, &'static str>) -> Range<'a, &'new str> {
34839 fn range<T: Sync + Ord>(v: &BTreeSet<T>) -> impl Sync + '_ {
34840 v.range(..)
34878 fn range<T: Send + Sync + Ord>(v: &BTreeSet<T>) -> impl Send + '_ {
34879 v.range(..)
35819 assert_eq!(map.range(..).next(), None);
35820 assert_eq!(map.range(..1).next(), None);
35821 assert_eq!(map.range(1..).next(), None);
35822 assert_eq!(map.range(1..=1).next(), None);
35823 assert_eq!(map.range(1..2).next(), None);
35883 assert_eq!(map.range(..).next(), None);
35884 assert_eq!(map.range(..1).next(), None);
35885 assert_eq!(map.range(1..).next(), None);
35886 assert_eq!(map.range(1..=1).next(), None);
35887 assert_eq!(map.range(1..2).next(), None);
36099 assert_eq!(a.range(..).min(), None);
36100 assert_eq!(a.range(..).max(), None);
36115 assert_eq!(a.range(..).min(), Some((&1, &42)));
36116 assert_eq!(a.range(..).max(), Some((&2, &24)));
36128 fn range_keys(map: &BTreeMap<i32, i32>, range: impl RangeBounds<i32>) -> Vec<i32> {
36129 map.range(range)
36280 check(map.range(..=100), map.range(..101));
36281 check(map.range(5..=8), vec![(&5, &5), (&6, &6), (&7, &7), (&8, &8)]);
36282 check(map.range(-1..=2), vec![(&1, &1), (&2, &2)]);
36290 assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);
36296 assert_eq!(map.range((Included(2), Excluded(2))).next(), None);
36297 assert_eq!(map.range((Excluded(2), Included(2))).next(), None);
36304 map.range((Excluded(2), Excluded(2)));
36311 map.range((Included(3), Included(2)));
36318 map.range((Included(3), Excluded(2)));
36325 map.range((Excluded(3), Included(2)));
36332 map.range((Excluded(3), Excluded(2)));
36339 // Lacking static_assert, call `range` conditionally, to emphasise that
36343 map.range(Cyclic3::C..=Cyclic3::A);
36384 map.range(EvilTwin(5)..=EvilTwin(7));
36394 let mut kvs = map.range((min, max)).map(|(&k, &v)| (k, v));
36419 let mut iter = map.range::<str, _>((Included("b"), Excluded("d")));
36434 let mut kvs = map.range((Included(&i), Included(&j))).map(|(&k, &v)| (k, v));
36818 fn range<T: Ord>(v: &BTreeMap<Box<T>, ()>, t: T) {
36819 v.range(t..);
37209 fn range<T: Sync + Ord>(v: &BTreeMap<T, T>) -> impl Sync + '_ {
37210 v.range(..)
37278 fn range<T: Send + Sync + Ord>(v: &BTreeMap<T, T>) -> impl Send + '_ {
37279 v.range(..)
38435 /// Every item returned by `range` is a valid edge index for the node.
38436 unsafe fn correct_childrens_parent_links<R: Iterator<Item = usize>>(&mut self, range: R) {
38437 for i in range {
40238 /// Returns the two slices that cover the `VecDeque`'s valid range
41419 fn range_tail_head<R>(&self, range: R) -> (usize, usize)
41423 let Range { start, end } = slice::range(range, ..self.len());
41429 /// Creates an iterator that covers the specified range in the `VecDeque`.
41442 /// let range = v.range(2..).copied().collect::<VecDeque<_>>();
41443 /// assert_eq!(range, [3]);
41445 /// // A full range covers all contents
41446 /// let all = v.range(..);
41451 pub fn range<R>(&self, range: R) -> Iter<'_, T>
41455 let (tail, head) = self.range_tail_head(range);
41464 /// Creates an iterator that covers the specified mutable range in the `VecDeque`.
41482 /// // A full range covers all contents
41490 pub fn range_mut<R>(&mut self, range: R) -> IterMut<'_, T>
41494 let (tail, head) = self.range_tail_head(range);
41506 /// Creates a draining iterator that removes the specified range in the
41509 /// Note 1: The element range is removed even if the iterator is not
41531 /// // A full range clears all contents
41537 pub fn drain<R>(&mut self, range: R) -> Drain<'_, T>
41551 let (drain_tail, drain_head) = self.range_tail_head(range);
43758 let range: VecDeque<_> = tester.range(start..end).copied().collect();
43760 assert_eq!(range, expected);
43786 let range: VecDeque<_> = tester.range_mut(start..end).map(|v| *v).collect();
43788 assert_eq!(range, expected);
46312 /// Current remaining range to remove
46752 // all we can do is check if it's still in range
48510 /// Creates a draining iterator that removes the specified range in the vector
48513 /// When the iterator **is** dropped, all elements in the range are removed
48531 /// // A full range clears the vector
48536 pub fn drain<R>(&mut self, range: R) -> Drain<'_, T, A>
48551 let Range { start, end } = slice::range(range, ..len);
48622 /// Returns a newly allocated vector containing the elements in the range
48930 /// Copies elements from `src` range to the end of the vector.
48951 let range = slice::range(src, ..self.len());
48952 self.reserve(range.len());
48955 // - `slice::range` guarantees that the given range is valid for indexing self
48957 self.spec_extend_from_within(range);
49321 /// Creates a splicing iterator that replaces the specified range in the vector
49323 /// `replace_with` does not need to be the same length as `range`.
49325 /// `range` is removed even if the iterator is not consumed until the end.
49334 /// * The tail (elements in the vector after `range`) is empty,
49335 /// * or `replace_with` yields fewer or equal elements than `range`’s length
49356 pub fn splice<R, I>(&mut self, range: R, replace_with: I) -> Splice<'_, I::IntoIter, A>
49361 Splice { drain: self.drain(range), replace_with: replace_with.into_iter() }
50018 // First fill the range left by drain().
50050 /// The range from `self.vec.len` to `self.tail_start` contains elements
50052 /// Fill that range as much as possible with new elements from the `replace_with` iterator.
50053 /// Returns `true` if we filled the entire range. (`replace_with.next()` didn’t return `None`.)