1 | use std::ops; |
2 | |
3 | pub trait Range<T> { |
4 | fn start(&self) -> Option<&T> { |
5 | None |
6 | } |
7 | |
8 | fn end(&self) -> Option<&T> { |
9 | None |
10 | } |
11 | } |
12 | |
13 | impl<T> Range<T> for ops::Range<T> { |
14 | fn start(&self) -> Option<&T> { |
15 | Some(&self.start) |
16 | } |
17 | |
18 | fn end(&self) -> Option<&T> { |
19 | Some(&self.end) |
20 | } |
21 | } |
22 | |
23 | impl<T> Range<T> for ops::RangeTo<T> { |
24 | fn end(&self) -> Option<&T> { |
25 | Some(&self.end) |
26 | } |
27 | } |
28 | |
29 | impl<T> Range<T> for ops::RangeFrom<T> { |
30 | fn start(&self) -> Option<&T> { |
31 | Some(&self.start) |
32 | } |
33 | } |
34 | |
35 | impl<T> Range<T> for ops::RangeFull {} |
36 | |