Expand description
§any-range
AnyRange<T> enum can hold any Range*<T> type.
§Use Cases
- Store any kind of range in a struct without adding a type parameter
§Features
no_std, depends only oncoreforbid(unsafe_code)- 100% test coverage
§Limitations
- Uses more bytes than a plain
Range<T>. The alignment ofTdetermines how many extra bytes the enum uses.
§Alternatives
anyrange- Should be called
ToRange - Doesn’t support
RangeInclusiveorRangeToInclusive - Unmaintained
- Should be called
§Example
use any_range::AnyRange;
let r = AnyRange::from(3..5);
assert!(r.contains(&3));
assert_eq!("de", &"abcdefg"[r.bounds()]);§Cargo Geiger Safety Report
§Changelog
- v0.1.4 - Add
boundsmethod for slicing - v0.1.3 - Implement
Hash,PartialOrd,Ord - v0.1.2 - Increase test coverage
- v0.1.1 - Update docs
- v0.1.0 - Initial version
Enums§
- AnyRange
- An enum that can hold any Range* type.