1use crate::fmt;
19use crate::hash::Hash;
20
21mod iter;
22
23#[stable(feature = "new_range_api_legacy", since = "1.98.0")]
24pub mod legacy;
25
26use core::ops::Bound::{self, Excluded, Included, Unbounded};
27
28#[doc(inline)]
29#[stable(feature = "new_range_from_api", since = "1.96.0")]
30pub use iter::RangeFromIter;
31#[doc(inline)]
32#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
33pub use iter::RangeInclusiveIter;
34#[doc(inline)]
35#[stable(feature = "new_range_api", since = "1.96.0")]
36pub use iter::RangeIter;
37
38use crate::iter::Step;
39use crate::ops::{IntoBounds, OneSidedRange, OneSidedRangeBound, RangeBounds};
42#[doc(inline)]
43#[stable(feature = "new_range_api_exports", since = "1.98.0")]
44pub use crate::ops::{RangeFull, RangeTo};
45
46#[lang = "RangeCopy"]
65#[derive(#[automatically_derived]
#[stable(feature = "new_range_api", since = "1.96.0")]
impl<Idx: crate::marker::Copy> crate::marker::Copy for Range<Idx> { }Copy, #[automatically_derived]
#[stable(feature = "new_range_api", since = "1.96.0")]
impl<Idx: crate::hash::Hash> crate::hash::Hash for Range<Idx> {
#[inline]
fn hash<__H: crate::hash::Hasher>(&self, state: &mut __H) {
crate::hash::Hash::hash(&self.start, state);
crate::hash::Hash::hash(&self.end, state)
}
}Hash)]
66#[derive_const(#[automatically_derived]
#[rustc_const_unstable(feature = "derive_const", issue = "118304")]
#[stable(feature = "new_range_api", since = "1.96.0")]
const impl<Idx: [const] crate::clone::Clone> crate::clone::Clone for
Range<Idx> {
#[inline]
fn clone(&self) -> Range<Idx> {
Range {
start: crate::clone::Clone::clone(&self.start),
end: crate::clone::Clone::clone(&self.end),
}
}
}Clone, #[automatically_derived]
#[rustc_const_unstable(feature = "derive_const", issue = "118304")]
#[stable(feature = "new_range_api", since = "1.96.0")]
const impl<Idx: [const] crate::default::Default> crate::default::Default for
Range<Idx> {
#[inline]
fn default() -> Range<Idx> {
Range {
start: crate::default::Default::default(),
end: crate::default::Default::default(),
}
}
}Default, #[automatically_derived]
#[stable(feature = "new_range_api", since = "1.96.0")]
impl<Idx: crate::cmp::PartialEq> crate::marker::StructuralPartialEq for
Range<Idx> {
}
#[automatically_derived]
#[rustc_const_unstable(feature = "derive_const", issue = "118304")]
#[stable(feature = "new_range_api", since = "1.96.0")]
const impl<Idx: [const] crate::cmp::PartialEq> crate::cmp::PartialEq for
Range<Idx> {
#[inline]
fn eq(&self, other: &Range<Idx>) -> bool {
self.start == other.start && self.end == other.end
}
}PartialEq, #[automatically_derived]
#[rustc_const_unstable(feature = "derive_const", issue = "118304")]
#[stable(feature = "new_range_api", since = "1.96.0")]
const impl<Idx: [const] crate::cmp::Eq> crate::cmp::Eq for Range<Idx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: crate::cmp::AssertParamIsEq<Idx>;
}
}Eq)]
67#[stable(feature = "new_range_api", since = "1.96.0")]
68pub struct Range<Idx> {
69 #[stable(feature = "new_range_api", since = "1.96.0")]
71 pub start: Idx,
72 #[stable(feature = "new_range_api", since = "1.96.0")]
74 pub end: Idx,
75}
76
77#[stable(feature = "new_range_api", since = "1.96.0")]
78impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
79 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
80 self.start.fmt(fmt)?;
81 fmt.write_fmt(format_args!(".."))write!(fmt, "..")?;
82 self.end.fmt(fmt)?;
83 Ok(())
84 }
85}
86
87impl<Idx: Step> Range<Idx> {
88 #[stable(feature = "new_range_api", since = "1.96.0")]
103 #[inline]
104 pub fn iter(&self) -> RangeIter<Idx> {
105 self.clone().into_iter()
106 }
107}
108
109impl<Idx: PartialOrd<Idx>> Range<Idx> {
110 #[inline]
131 #[stable(feature = "new_range_api", since = "1.96.0")]
132 #[rustc_const_unstable(feature = "const_range", issue = "none")]
133 pub const fn contains<U>(&self, item: &U) -> bool
134 where
135 Idx: [const] PartialOrd<U>,
136 U: ?Sized + [const] PartialOrd<Idx>,
137 {
138 <Self as RangeBounds<Idx>>::contains(self, item)
139 }
140
141 #[inline]
163 #[stable(feature = "new_range_api", since = "1.96.0")]
164 #[rustc_const_unstable(feature = "const_range", issue = "none")]
165 #[expect(clippy::neg_cmp_op_on_partial_ord, reason = "incomparable ranges are empty")]
166 pub const fn is_empty(&self) -> bool
167 where
168 Idx: [const] PartialOrd,
169 {
170 !(self.start < self.end)
171 }
172}
173
174#[stable(feature = "new_range_api", since = "1.96.0")]
175#[rustc_const_unstable(feature = "const_range", issue = "none")]
176const impl<T> RangeBounds<T> for Range<T> {
177 fn start_bound(&self) -> Bound<&T> {
178 Included(&self.start)
179 }
180 fn end_bound(&self) -> Bound<&T> {
181 Excluded(&self.end)
182 }
183}
184
185#[stable(feature = "new_range_api", since = "1.96.0")]
192#[rustc_const_unstable(feature = "const_range", issue = "none")]
193const impl<T> RangeBounds<T> for Range<&T> {
194 fn start_bound(&self) -> Bound<&T> {
195 Included(self.start)
196 }
197 fn end_bound(&self) -> Bound<&T> {
198 Excluded(self.end)
199 }
200}
201
202#[unstable(feature = "range_into_bounds", issue = "136903")]
203#[rustc_const_unstable(feature = "const_range", issue = "none")]
204const impl<T> IntoBounds<T> for Range<T> {
205 fn into_bounds(self) -> (Bound<T>, Bound<T>) {
206 (Included(self.start), Excluded(self.end))
207 }
208}
209
210#[stable(feature = "new_range_api", since = "1.96.0")]
211#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
212const impl<T> From<Range<T>> for legacy::Range<T> {
213 #[inline]
214 fn from(value: Range<T>) -> Self {
215 Self { start: value.start, end: value.end }
216 }
217}
218#[stable(feature = "new_range_api", since = "1.96.0")]
219#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
220const impl<T> From<legacy::Range<T>> for Range<T> {
221 #[inline]
222 fn from(value: legacy::Range<T>) -> Self {
223 Self { start: value.start, end: value.end }
224 }
225}
226
227#[lang = "RangeInclusiveCopy"]
246#[derive(#[automatically_derived]
#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
impl<Idx: crate::clone::Clone> crate::clone::Clone for RangeInclusive<Idx> {
#[inline]
fn clone(&self) -> RangeInclusive<Idx> {
RangeInclusive {
start: crate::clone::Clone::clone(&self.start),
last: crate::clone::Clone::clone(&self.last),
}
}
}Clone, #[automatically_derived]
#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
impl<Idx: crate::marker::Copy> crate::marker::Copy for RangeInclusive<Idx> { }Copy, #[automatically_derived]
#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
impl<Idx: crate::cmp::PartialEq> crate::marker::StructuralPartialEq for
RangeInclusive<Idx> {
}
#[automatically_derived]
#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
impl<Idx: crate::cmp::PartialEq> crate::cmp::PartialEq for RangeInclusive<Idx>
{
#[inline]
fn eq(&self, other: &RangeInclusive<Idx>) -> bool {
self.start == other.start && self.last == other.last
}
}PartialEq, #[automatically_derived]
#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
impl<Idx: crate::cmp::Eq> crate::cmp::Eq for RangeInclusive<Idx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: crate::cmp::AssertParamIsEq<Idx>;
}
}Eq, #[automatically_derived]
#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
impl<Idx: crate::hash::Hash> crate::hash::Hash for RangeInclusive<Idx> {
#[inline]
fn hash<__H: crate::hash::Hasher>(&self, state: &mut __H) {
crate::hash::Hash::hash(&self.start, state);
crate::hash::Hash::hash(&self.last, state)
}
}Hash)]
247#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
248pub struct RangeInclusive<Idx> {
249 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
251 pub start: Idx,
252 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
254 pub last: Idx,
255}
256
257#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
258impl<Idx: fmt::Debug> fmt::Debug for RangeInclusive<Idx> {
259 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
260 self.start.fmt(fmt)?;
261 fmt.write_fmt(format_args!("..="))write!(fmt, "..=")?;
262 self.last.fmt(fmt)?;
263 Ok(())
264 }
265}
266
267impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
268 #[inline]
290 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
291 #[rustc_const_unstable(feature = "const_range", issue = "none")]
292 pub const fn contains<U>(&self, item: &U) -> bool
293 where
294 Idx: [const] PartialOrd<U>,
295 U: ?Sized + [const] PartialOrd<Idx>,
296 {
297 <Self as RangeBounds<Idx>>::contains(self, item)
298 }
299
300 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
322 #[inline]
323 #[rustc_const_unstable(feature = "const_range", issue = "none")]
324 #[expect(clippy::neg_cmp_op_on_partial_ord, reason = "incomparable ranges are empty")]
325 pub const fn is_empty(&self) -> bool
326 where
327 Idx: [const] PartialOrd,
328 {
329 !(self.start <= self.last)
330 }
331}
332
333impl<Idx: Step> RangeInclusive<Idx> {
334 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
349 #[inline]
350 pub fn iter(&self) -> RangeInclusiveIter<Idx> {
351 self.clone().into_iter()
352 }
353}
354
355#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
356#[rustc_const_unstable(feature = "const_range", issue = "none")]
357const impl<T> RangeBounds<T> for RangeInclusive<T> {
358 fn start_bound(&self) -> Bound<&T> {
359 Included(&self.start)
360 }
361 fn end_bound(&self) -> Bound<&T> {
362 Included(&self.last)
363 }
364}
365
366#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
373#[rustc_const_unstable(feature = "const_range", issue = "none")]
374const impl<T> RangeBounds<T> for RangeInclusive<&T> {
375 fn start_bound(&self) -> Bound<&T> {
376 Included(self.start)
377 }
378 fn end_bound(&self) -> Bound<&T> {
379 Included(self.last)
380 }
381}
382
383#[unstable(feature = "range_into_bounds", issue = "136903")]
385#[rustc_const_unstable(feature = "const_range", issue = "none")]
386const impl<T> IntoBounds<T> for RangeInclusive<T> {
387 fn into_bounds(self) -> (Bound<T>, Bound<T>) {
388 (Included(self.start), Included(self.last))
389 }
390}
391
392#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
393#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
394const impl<T> From<RangeInclusive<T>> for legacy::RangeInclusive<T> {
395 #[inline]
396 fn from(value: RangeInclusive<T>) -> Self {
397 Self::new(value.start, value.last)
398 }
399}
400#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
401#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
402const impl<T> From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
403 #[inline]
444 fn from(value: legacy::RangeInclusive<T>) -> Self {
445 if !!value.exhausted {
{
crate::panicking::panic_fmt(format_args!("attempted to convert from an exhausted `legacy::RangeInclusive`"));
}
};assert!(
446 !value.exhausted,
447 "attempted to convert from an exhausted `legacy::RangeInclusive`"
448 );
449
450 let (start, last) = value.into_inner();
451 RangeInclusive { start, last }
452 }
453}
454
455#[lang = "RangeFromCopy"]
483#[derive(#[automatically_derived]
#[stable(feature = "new_range_from_api", since = "1.96.0")]
impl<Idx: crate::marker::Copy> crate::marker::Copy for RangeFrom<Idx> { }Copy, #[automatically_derived]
#[stable(feature = "new_range_from_api", since = "1.96.0")]
impl<Idx: crate::hash::Hash> crate::hash::Hash for RangeFrom<Idx> {
#[inline]
fn hash<__H: crate::hash::Hasher>(&self, state: &mut __H) {
crate::hash::Hash::hash(&self.start, state)
}
}Hash)]
484#[derive_const(#[automatically_derived]
#[rustc_const_unstable(feature = "derive_const", issue = "118304")]
#[stable(feature = "new_range_from_api", since = "1.96.0")]
const impl<Idx: [const] crate::clone::Clone> crate::clone::Clone for
RangeFrom<Idx> {
#[inline]
fn clone(&self) -> RangeFrom<Idx> {
RangeFrom { start: crate::clone::Clone::clone(&self.start) }
}
}Clone, #[automatically_derived]
#[stable(feature = "new_range_from_api", since = "1.96.0")]
impl<Idx: crate::cmp::PartialEq> crate::marker::StructuralPartialEq for
RangeFrom<Idx> {
}
#[automatically_derived]
#[rustc_const_unstable(feature = "derive_const", issue = "118304")]
#[stable(feature = "new_range_from_api", since = "1.96.0")]
const impl<Idx: [const] crate::cmp::PartialEq> crate::cmp::PartialEq for
RangeFrom<Idx> {
#[inline]
fn eq(&self, other: &RangeFrom<Idx>) -> bool { self.start == other.start }
}PartialEq, #[automatically_derived]
#[rustc_const_unstable(feature = "derive_const", issue = "118304")]
#[stable(feature = "new_range_from_api", since = "1.96.0")]
const impl<Idx: [const] crate::cmp::Eq> crate::cmp::Eq for RangeFrom<Idx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: crate::cmp::AssertParamIsEq<Idx>;
}
}Eq)]
485#[stable(feature = "new_range_from_api", since = "1.96.0")]
486pub struct RangeFrom<Idx> {
487 #[stable(feature = "new_range_from_api", since = "1.96.0")]
489 pub start: Idx,
490}
491
492#[stable(feature = "new_range_from_api", since = "1.96.0")]
493impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
494 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
495 self.start.fmt(fmt)?;
496 fmt.write_fmt(format_args!(".."))write!(fmt, "..")?;
497 Ok(())
498 }
499}
500
501impl<Idx: Step> RangeFrom<Idx> {
502 #[stable(feature = "new_range_from_api", since = "1.96.0")]
517 #[inline]
518 pub fn iter(&self) -> RangeFromIter<Idx> {
519 self.clone().into_iter()
520 }
521}
522
523impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
524 #[inline]
540 #[stable(feature = "new_range_from_api", since = "1.96.0")]
541 #[rustc_const_unstable(feature = "const_range", issue = "none")]
542 pub const fn contains<U>(&self, item: &U) -> bool
543 where
544 Idx: [const] PartialOrd<U>,
545 U: ?Sized + [const] PartialOrd<Idx>,
546 {
547 <Self as RangeBounds<Idx>>::contains(self, item)
548 }
549}
550
551#[stable(feature = "new_range_from_api", since = "1.96.0")]
552#[rustc_const_unstable(feature = "const_range", issue = "none")]
553const impl<T> RangeBounds<T> for RangeFrom<T> {
554 fn start_bound(&self) -> Bound<&T> {
555 Included(&self.start)
556 }
557 fn end_bound(&self) -> Bound<&T> {
558 Unbounded
559 }
560}
561
562#[stable(feature = "new_range_from_api", since = "1.96.0")]
569#[rustc_const_unstable(feature = "const_range", issue = "none")]
570const impl<T> RangeBounds<T> for RangeFrom<&T> {
571 fn start_bound(&self) -> Bound<&T> {
572 Included(self.start)
573 }
574 fn end_bound(&self) -> Bound<&T> {
575 Unbounded
576 }
577}
578
579#[unstable(feature = "range_into_bounds", issue = "136903")]
580#[rustc_const_unstable(feature = "const_range", issue = "none")]
581const impl<T> IntoBounds<T> for RangeFrom<T> {
582 fn into_bounds(self) -> (Bound<T>, Bound<T>) {
583 (Included(self.start), Unbounded)
584 }
585}
586
587#[unstable(feature = "one_sided_range", issue = "69780")]
588#[rustc_const_unstable(feature = "const_range", issue = "none")]
589const impl<T> OneSidedRange<T> for RangeFrom<T>
590where
591 Self: RangeBounds<T>,
592{
593 fn bound(self) -> (OneSidedRangeBound, T) {
594 (OneSidedRangeBound::StartInclusive, self.start)
595 }
596}
597
598#[stable(feature = "new_range_from_api", since = "1.96.0")]
599#[rustc_const_unstable(feature = "const_index", issue = "143775")]
600const impl<T> From<RangeFrom<T>> for legacy::RangeFrom<T> {
601 #[inline]
602 fn from(value: RangeFrom<T>) -> Self {
603 Self { start: value.start }
604 }
605}
606#[stable(feature = "new_range_from_api", since = "1.96.0")]
607#[rustc_const_unstable(feature = "const_index", issue = "143775")]
608const impl<T> From<legacy::RangeFrom<T>> for RangeFrom<T> {
609 #[inline]
610 fn from(value: legacy::RangeFrom<T>) -> Self {
611 Self { start: value.start }
612 }
613}
614
615#[lang = "RangeToInclusiveCopy"]
658#[doc(alias = "..=")]
659#[derive(#[automatically_derived]
#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
impl<Idx: crate::marker::Copy> crate::marker::Copy for RangeToInclusive<Idx> {
}Copy, #[automatically_derived]
#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
impl<Idx: crate::clone::Clone> crate::clone::Clone for RangeToInclusive<Idx> {
#[inline]
fn clone(&self) -> RangeToInclusive<Idx> {
RangeToInclusive { last: crate::clone::Clone::clone(&self.last) }
}
}Clone, #[automatically_derived]
#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
impl<Idx: crate::cmp::PartialEq> crate::marker::StructuralPartialEq for
RangeToInclusive<Idx> {
}
#[automatically_derived]
#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
impl<Idx: crate::cmp::PartialEq> crate::cmp::PartialEq for
RangeToInclusive<Idx> {
#[inline]
fn eq(&self, other: &RangeToInclusive<Idx>) -> bool {
self.last == other.last
}
}PartialEq, #[automatically_derived]
#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
impl<Idx: crate::cmp::Eq> crate::cmp::Eq for RangeToInclusive<Idx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: crate::cmp::AssertParamIsEq<Idx>;
}
}Eq, #[automatically_derived]
#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
impl<Idx: crate::hash::Hash> crate::hash::Hash for RangeToInclusive<Idx> {
#[inline]
fn hash<__H: crate::hash::Hasher>(&self, state: &mut __H) {
crate::hash::Hash::hash(&self.last, state)
}
}Hash)]
660#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
661pub struct RangeToInclusive<Idx> {
662 #[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
664 pub last: Idx,
665}
666
667#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
668impl<Idx: fmt::Debug> fmt::Debug for RangeToInclusive<Idx> {
669 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
670 fmt.write_fmt(format_args!("..="))write!(fmt, "..=")?;
671 self.last.fmt(fmt)?;
672 Ok(())
673 }
674}
675
676impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
677 #[inline]
691 #[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
692 #[rustc_const_unstable(feature = "const_range", issue = "none")]
693 pub const fn contains<U>(&self, item: &U) -> bool
694 where
695 Idx: [const] PartialOrd<U>,
696 U: ?Sized + [const] PartialOrd<Idx>,
697 {
698 <Self as RangeBounds<Idx>>::contains(self, item)
699 }
700}
701
702#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
703impl<T> From<legacy::RangeToInclusive<T>> for RangeToInclusive<T> {
704 fn from(value: legacy::RangeToInclusive<T>) -> Self {
705 Self { last: value.end }
706 }
707}
708#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
709impl<T> From<RangeToInclusive<T>> for legacy::RangeToInclusive<T> {
710 fn from(value: RangeToInclusive<T>) -> Self {
711 Self { end: value.last }
712 }
713}
714
715#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
719#[rustc_const_unstable(feature = "const_range", issue = "none")]
720const impl<T> RangeBounds<T> for RangeToInclusive<T> {
721 fn start_bound(&self) -> Bound<&T> {
722 Unbounded
723 }
724 fn end_bound(&self) -> Bound<&T> {
725 Included(&self.last)
726 }
727}
728
729#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
730#[rustc_const_unstable(feature = "const_range", issue = "none")]
731const impl<T> RangeBounds<T> for RangeToInclusive<&T> {
732 fn start_bound(&self) -> Bound<&T> {
733 Unbounded
734 }
735 fn end_bound(&self) -> Bound<&T> {
736 Included(self.last)
737 }
738}
739
740#[unstable(feature = "range_into_bounds", issue = "136903")]
741#[rustc_const_unstable(feature = "const_range", issue = "none")]
742const impl<T> IntoBounds<T> for RangeToInclusive<T> {
743 fn into_bounds(self) -> (Bound<T>, Bound<T>) {
744 (Unbounded, Included(self.last))
745 }
746}
747
748#[unstable(feature = "one_sided_range", issue = "69780")]
749#[rustc_const_unstable(feature = "const_range", issue = "none")]
750const impl<T> OneSidedRange<T> for RangeToInclusive<T>
751where
752 Self: RangeBounds<T>,
753{
754 fn bound(self) -> (OneSidedRangeBound, T) {
755 (OneSidedRangeBound::EndInclusive, self.last)
756 }
757}