File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -846,6 +846,27 @@ impl<V: Ord + Clone> Ranges<V> {
846
846
}
847
847
}
848
848
849
+ // Newtype to avoid leaking our internal representation.
850
+ pub struct RangesIter < V > ( smallvec:: IntoIter < [ Interval < V > ; 1 ] > ) ;
851
+
852
+ impl < V > Iterator for RangesIter < V > {
853
+ type Item = Interval < V > ;
854
+
855
+ fn next ( & mut self ) -> Option < Self :: Item > {
856
+ self . 0 . next ( )
857
+ }
858
+ }
859
+
860
+ impl < V > IntoIterator for Ranges < V > {
861
+ type Item = ( Bound < V > , Bound < V > ) ;
862
+ // Newtype to avoid leaking our internal representation.
863
+ type IntoIter = RangesIter < V > ;
864
+
865
+ fn into_iter ( self ) -> Self :: IntoIter {
866
+ RangesIter ( self . segments . into_iter ( ) )
867
+ }
868
+ }
869
+
849
870
// REPORT ######################################################################
850
871
851
872
impl < V : Display + Eq > Display for Ranges < V > {
You can’t perform that action at this time.
0 commit comments