nekolib/traits/
range_bounds.rs1use std::ops::{
4 Range, RangeBounds, RangeFrom, RangeFull, RangeInclusive, RangeTo,
5 RangeToInclusive,
6};
7
8pub trait StartBounded<T>: RangeBounds<T> {}
10pub trait StartInclusive<T>: StartBounded<T> {}
12pub trait StartUnbounded<T>: RangeBounds<T> {}
14pub trait EndBounded<T>: RangeBounds<T> {}
16pub trait EndExclusive<T>: EndBounded<T> {}
18pub trait EndInclusive<T>: EndBounded<T> {}
20pub trait EndUnbounded<T>: RangeBounds<T> {}
22
23impl<T> StartBounded<T> for Range<T> {}
24impl<T> StartBounded<T> for RangeInclusive<T> {}
25impl<T> StartBounded<T> for RangeFrom<T> {}
26impl<T> StartUnbounded<T> for RangeTo<T> {}
27impl<T> StartUnbounded<T> for RangeToInclusive<T> {}
28impl<T> StartUnbounded<T> for RangeFull {}
29
30impl<T> StartInclusive<T> for Range<T> {}
31impl<T> StartInclusive<T> for RangeInclusive<T> {}
32impl<T> StartInclusive<T> for RangeFrom<T> {}
33
34impl<T> EndBounded<T> for Range<T> {}
35impl<T> EndBounded<T> for RangeInclusive<T> {}
36impl<T> EndUnbounded<T> for RangeFrom<T> {}
37impl<T> EndBounded<T> for RangeTo<T> {}
38impl<T> EndBounded<T> for RangeToInclusive<T> {}
39impl<T> EndUnbounded<T> for RangeFull {}
40
41impl<T> EndExclusive<T> for Range<T> {}
42impl<T> EndInclusive<T> for RangeInclusive<T> {}
43impl<T> EndExclusive<T> for RangeTo<T> {}
44impl<T> EndInclusive<T> for RangeToInclusive<T> {}