@@ -65,7 +65,7 @@ println(eqivalent) // 1..1.9999999999999998
65
65
- Swift: ` ... ` end-inclusive range, ` ..< ` end-exclusive, supports one-sided ranges
66
66
- Ruby: ` .. ` end-inclusive range, ` ... ` end-exclusive, supports one-sided ranges
67
67
- Groovy: ` .. ` end-inclusive range, ` ..< ` end-exclusive, ` <.. ` start-exclusive, ` <..< ` both bounds-exclusive range
68
-
68
+ - Rust: ` ..= ` end-inclusive range, ` .. ` end-exclusive, supports one-sided ranges
69
69
70
70
### Libraries for representing ranges
71
71
@@ -86,6 +86,16 @@ println(eqivalent) // 1..1.9999999999999998
86
86
The base protocol provides operations of checking whether the range contains a value and slicing a collection
87
87
(i.e. producing the closed range of indices of the collection with the matching index type that are contained in the range).
88
88
89
+ - Rust provides 6 structs in the standard library to represent ranges, varying by their boundness and inclusiveness of the end bound:
90
+ [ ` Range ` ] ( https://doc.rust-lang.org/std/ops/struct.Range.html ) , [ ` RangeInclusive ` ] ( https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html ) ,
91
+ [ ` RangeFrom ` ] ( https://doc.rust-lang.org/std/ops/struct.RangeFrom.html ) ,
92
+ [ ` RangeTo ` ] ( https://doc.rust-lang.org/std/ops/struct.RangeTo.html ) , [ ` RangeToInclusive ` ] ( https://doc.rust-lang.org/std/ops/struct.RangeTo.html ) ,
93
+ [ ` RangeFull ` ] ( https://doc.rust-lang.org/std/ops/struct.RangeTo.html ) .
94
+
95
+ There's also a crate that provides a more generic [ ` GenericRange ` ] ( https://docs.rs/ranges/latest/ranges/struct.GenericRange.html ) implementation
96
+ that covers all of the above range variants and allows to express other type of ranges, like one with an excluded start bound.
97
+
98
+
89
99
- [ kotlin-statistics] ( https://github.com/thomasnield/kotlin-statistics/blob/master/src/main/kotlin/org/nield/kotlinstatistics/range )
90
100
library provides the base ` Range ` type and individual types for each combination of included/excluded bounds:
91
101
` OpenRange ` , ` OpenClosedRange ` , ` ClosedOpenRange ` , ` XClosedRange ` .
0 commit comments