We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0d63cc6 commit 78b8addCopy full SHA for 78b8add
src/range.rs
@@ -122,6 +122,24 @@ impl<V> Range<V> {
122
pub fn is_empty(&self) -> bool {
123
self.segments.is_empty()
124
}
125
+
126
+ /// Return all boundary versions of this range.
127
+ pub fn bounds(&self) -> impl Iterator<Item = &V> {
128
+ self.segments.iter().flat_map(|segment| {
129
+ let (v1, v2) = segment;
130
+ let v1 = match v1 {
131
+ Included(v) => Some(v),
132
+ Excluded(v) => Some(v),
133
+ Unbounded => None,
134
+ };
135
+ let v2 = match v2 {
136
137
138
139
140
+ v1.into_iter().chain(v2)
141
+ })
142
+ }
143
144
145
impl<V: Clone> Range<V> {
0 commit comments