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"]
69#[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)]
70#[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)]
71#[stable(feature = "new_range_api", since = "1.96.0")]
72pub struct Range<Idx> {
73 #[stable(feature = "new_range_api", since = "1.96.0")]
75 pub start: Idx,
76 #[stable(feature = "new_range_api", since = "1.96.0")]
78 pub end: Idx,
79}
80
81#[stable(feature = "new_range_api", since = "1.96.0")]
82impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
83 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
84 self.start.fmt(fmt)?;
85 fmt.write_fmt(format_args!(".."))write!(fmt, "..")?;
86 self.end.fmt(fmt)?;
87 Ok(())
88 }
89}
90
91impl<Idx: Step> Range<Idx> {
92 #[stable(feature = "new_range_api", since = "1.96.0")]
107 #[inline]
108 pub fn iter(&self) -> RangeIter<Idx> {
109 self.clone().into_iter()
110 }
111}
112
113impl<Idx: PartialOrd<Idx>> Range<Idx> {
114 #[inline]
135 #[stable(feature = "new_range_api", since = "1.96.0")]
136 #[rustc_const_unstable(feature = "const_range", issue = "none")]
137 pub const fn contains<U>(&self, item: &U) -> bool
138 where
139 Idx: [const] PartialOrd<U>,
140 U: ?Sized + [const] PartialOrd<Idx>,
141 {
142 <Self as RangeBounds<Idx>>::contains(self, item)
143 }
144
145 #[inline]
167 #[stable(feature = "new_range_api", since = "1.96.0")]
168 #[rustc_const_unstable(feature = "const_range", issue = "none")]
169 #[expect(clippy::neg_cmp_op_on_partial_ord, reason = "incomparable ranges are empty")]
170 pub const fn is_empty(&self) -> bool
171 where
172 Idx: [const] PartialOrd,
173 {
174 !(self.start < self.end)
175 }
176}
177
178#[stable(feature = "new_range_api", since = "1.96.0")]
179#[rustc_const_unstable(feature = "const_range", issue = "none")]
180const impl<T> RangeBounds<T> for Range<T> {
181 fn start_bound(&self) -> Bound<&T> {
182 Included(&self.start)
183 }
184 fn end_bound(&self) -> Bound<&T> {
185 Excluded(&self.end)
186 }
187}
188
189#[stable(feature = "new_range_api", since = "1.96.0")]
196#[rustc_const_unstable(feature = "const_range", issue = "none")]
197const impl<T> RangeBounds<T> for Range<&T> {
198 fn start_bound(&self) -> Bound<&T> {
199 Included(self.start)
200 }
201 fn end_bound(&self) -> Bound<&T> {
202 Excluded(self.end)
203 }
204}
205
206#[unstable(feature = "range_into_bounds", issue = "136903")]
207#[rustc_const_unstable(feature = "const_range", issue = "none")]
208const impl<T> IntoBounds<T> for Range<T> {
209 fn into_bounds(self) -> (Bound<T>, Bound<T>) {
210 (Included(self.start), Excluded(self.end))
211 }
212}
213
214#[stable(feature = "new_range_api", since = "1.96.0")]
215#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
216const impl<T> From<Range<T>> for legacy::Range<T> {
217 #[inline]
218 fn from(value: Range<T>) -> Self {
219 Self { start: value.start, end: value.end }
220 }
221}
222#[stable(feature = "new_range_api", since = "1.96.0")]
223#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
224const impl<T> From<legacy::Range<T>> for Range<T> {
225 #[inline]
226 fn from(value: legacy::Range<T>) -> Self {
227 Self { start: value.start, end: value.end }
228 }
229}
230
231#[lang = "RangeInclusiveCopy"]
250#[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)]
251#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
252pub struct RangeInclusive<Idx> {
253 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
255 pub start: Idx,
256 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
258 pub last: Idx,
259}
260
261#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
262impl<Idx: fmt::Debug> fmt::Debug for RangeInclusive<Idx> {
263 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
264 self.start.fmt(fmt)?;
265 fmt.write_fmt(format_args!("..="))write!(fmt, "..=")?;
266 self.last.fmt(fmt)?;
267 Ok(())
268 }
269}
270
271impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
272 #[inline]
294 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
295 #[rustc_const_unstable(feature = "const_range", issue = "none")]
296 pub const fn contains<U>(&self, item: &U) -> bool
297 where
298 Idx: [const] PartialOrd<U>,
299 U: ?Sized + [const] PartialOrd<Idx>,
300 {
301 <Self as RangeBounds<Idx>>::contains(self, item)
302 }
303
304 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
326 #[inline]
327 #[rustc_const_unstable(feature = "const_range", issue = "none")]
328 #[expect(clippy::neg_cmp_op_on_partial_ord, reason = "incomparable ranges are empty")]
329 pub const fn is_empty(&self) -> bool
330 where
331 Idx: [const] PartialOrd,
332 {
333 !(self.start <= self.last)
334 }
335}
336
337impl<Idx: Step> RangeInclusive<Idx> {
338 #[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
353 #[inline]
354 pub fn iter(&self) -> RangeInclusiveIter<Idx> {
355 self.clone().into_iter()
356 }
357}
358
359#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
360#[rustc_const_unstable(feature = "const_range", issue = "none")]
361const impl<T> RangeBounds<T> for RangeInclusive<T> {
362 fn start_bound(&self) -> Bound<&T> {
363 Included(&self.start)
364 }
365 fn end_bound(&self) -> Bound<&T> {
366 Included(&self.last)
367 }
368}
369
370#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
377#[rustc_const_unstable(feature = "const_range", issue = "none")]
378const impl<T> RangeBounds<T> for RangeInclusive<&T> {
379 fn start_bound(&self) -> Bound<&T> {
380 Included(self.start)
381 }
382 fn end_bound(&self) -> Bound<&T> {
383 Included(self.last)
384 }
385}
386
387#[unstable(feature = "range_into_bounds", issue = "136903")]
389#[rustc_const_unstable(feature = "const_range", issue = "none")]
390const impl<T> IntoBounds<T> for RangeInclusive<T> {
391 fn into_bounds(self) -> (Bound<T>, Bound<T>) {
392 (Included(self.start), Included(self.last))
393 }
394}
395
396#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
397#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
398const impl<T> From<RangeInclusive<T>> for legacy::RangeInclusive<T> {
399 #[inline]
400 fn from(value: RangeInclusive<T>) -> Self {
401 Self::new(value.start, value.last)
402 }
403}
404#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
405#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
406const impl<T> From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
407 #[inline]
448 fn from(value: legacy::RangeInclusive<T>) -> Self {
449 if !!value.exhausted {
{
crate::panicking::panic_fmt(format_args!("attempted to convert from an exhausted `legacy::RangeInclusive`"));
}
};assert!(
450 !value.exhausted,
451 "attempted to convert from an exhausted `legacy::RangeInclusive`"
452 );
453
454 let (start, last) = value.into_inner();
455 RangeInclusive { start, last }
456 }
457}
458
459#[lang = "RangeFromCopy"]
487#[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)]
488#[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)]
489#[stable(feature = "new_range_from_api", since = "1.96.0")]
490pub struct RangeFrom<Idx> {
491 #[stable(feature = "new_range_from_api", since = "1.96.0")]
493 pub start: Idx,
494}
495
496#[stable(feature = "new_range_from_api", since = "1.96.0")]
497impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
498 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
499 self.start.fmt(fmt)?;
500 fmt.write_fmt(format_args!(".."))write!(fmt, "..")?;
501 Ok(())
502 }
503}
504
505impl<Idx: Step> RangeFrom<Idx> {
506 #[stable(feature = "new_range_from_api", since = "1.96.0")]
521 #[inline]
522 pub fn iter(&self) -> RangeFromIter<Idx> {
523 self.clone().into_iter()
524 }
525}
526
527impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
528 #[inline]
544 #[stable(feature = "new_range_from_api", since = "1.96.0")]
545 #[rustc_const_unstable(feature = "const_range", issue = "none")]
546 pub const fn contains<U>(&self, item: &U) -> bool
547 where
548 Idx: [const] PartialOrd<U>,
549 U: ?Sized + [const] PartialOrd<Idx>,
550 {
551 <Self as RangeBounds<Idx>>::contains(self, item)
552 }
553}
554
555#[stable(feature = "new_range_from_api", since = "1.96.0")]
556#[rustc_const_unstable(feature = "const_range", issue = "none")]
557const impl<T> RangeBounds<T> for RangeFrom<T> {
558 fn start_bound(&self) -> Bound<&T> {
559 Included(&self.start)
560 }
561 fn end_bound(&self) -> Bound<&T> {
562 Unbounded
563 }
564}
565
566#[stable(feature = "new_range_from_api", since = "1.96.0")]
573#[rustc_const_unstable(feature = "const_range", issue = "none")]
574const impl<T> RangeBounds<T> for RangeFrom<&T> {
575 fn start_bound(&self) -> Bound<&T> {
576 Included(self.start)
577 }
578 fn end_bound(&self) -> Bound<&T> {
579 Unbounded
580 }
581}
582
583#[unstable(feature = "range_into_bounds", issue = "136903")]
584#[rustc_const_unstable(feature = "const_range", issue = "none")]
585const impl<T> IntoBounds<T> for RangeFrom<T> {
586 fn into_bounds(self) -> (Bound<T>, Bound<T>) {
587 (Included(self.start), Unbounded)
588 }
589}
590
591#[unstable(feature = "one_sided_range", issue = "69780")]
592#[rustc_const_unstable(feature = "const_range", issue = "none")]
593const impl<T> OneSidedRange<T> for RangeFrom<T>
594where
595 Self: RangeBounds<T>,
596{
597 fn bound(self) -> (OneSidedRangeBound, T) {
598 (OneSidedRangeBound::StartInclusive, self.start)
599 }
600}
601
602#[stable(feature = "new_range_from_api", since = "1.96.0")]
603#[rustc_const_unstable(feature = "const_index", issue = "143775")]
604const impl<T> From<RangeFrom<T>> for legacy::RangeFrom<T> {
605 #[inline]
606 fn from(value: RangeFrom<T>) -> Self {
607 Self { start: value.start }
608 }
609}
610#[stable(feature = "new_range_from_api", since = "1.96.0")]
611#[rustc_const_unstable(feature = "const_index", issue = "143775")]
612const impl<T> From<legacy::RangeFrom<T>> for RangeFrom<T> {
613 #[inline]
614 fn from(value: legacy::RangeFrom<T>) -> Self {
615 Self { start: value.start }
616 }
617}
618
619#[lang = "RangeToInclusiveCopy"]
662#[doc(alias = "..=")]
663#[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)]
664#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
665pub struct RangeToInclusive<Idx> {
666 #[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
668 pub last: Idx,
669}
670
671#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
672impl<Idx: fmt::Debug> fmt::Debug for RangeToInclusive<Idx> {
673 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
674 fmt.write_fmt(format_args!("..="))write!(fmt, "..=")?;
675 self.last.fmt(fmt)?;
676 Ok(())
677 }
678}
679
680impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
681 #[inline]
695 #[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
696 #[rustc_const_unstable(feature = "const_range", issue = "none")]
697 pub const fn contains<U>(&self, item: &U) -> bool
698 where
699 Idx: [const] PartialOrd<U>,
700 U: ?Sized + [const] PartialOrd<Idx>,
701 {
702 <Self as RangeBounds<Idx>>::contains(self, item)
703 }
704}
705
706#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
707impl<T> From<legacy::RangeToInclusive<T>> for RangeToInclusive<T> {
708 fn from(value: legacy::RangeToInclusive<T>) -> Self {
709 Self { last: value.end }
710 }
711}
712#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
713impl<T> From<RangeToInclusive<T>> for legacy::RangeToInclusive<T> {
714 fn from(value: RangeToInclusive<T>) -> Self {
715 Self { end: value.last }
716 }
717}
718
719#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
723#[rustc_const_unstable(feature = "const_range", issue = "none")]
724const impl<T> RangeBounds<T> for RangeToInclusive<T> {
725 fn start_bound(&self) -> Bound<&T> {
726 Unbounded
727 }
728 fn end_bound(&self) -> Bound<&T> {
729 Included(&self.last)
730 }
731}
732
733#[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")]
734#[rustc_const_unstable(feature = "const_range", issue = "none")]
735const impl<T> RangeBounds<T> for RangeToInclusive<&T> {
736 fn start_bound(&self) -> Bound<&T> {
737 Unbounded
738 }
739 fn end_bound(&self) -> Bound<&T> {
740 Included(self.last)
741 }
742}
743
744#[unstable(feature = "range_into_bounds", issue = "136903")]
745#[rustc_const_unstable(feature = "const_range", issue = "none")]
746const impl<T> IntoBounds<T> for RangeToInclusive<T> {
747 fn into_bounds(self) -> (Bound<T>, Bound<T>) {
748 (Unbounded, Included(self.last))
749 }
750}
751
752#[unstable(feature = "one_sided_range", issue = "69780")]
753#[rustc_const_unstable(feature = "const_range", issue = "none")]
754const impl<T> OneSidedRange<T> for RangeToInclusive<T>
755where
756 Self: RangeBounds<T>,
757{
758 fn bound(self) -> (OneSidedRangeBound, T) {
759 (OneSidedRangeBound::EndInclusive, self.last)
760 }
761}