Crate any_range[−][src]
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)
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 range: AnyRange<u8> = (3..5).into(); assert!(range.contains(&3));
Cargo Geiger Safety Report
Enums
| AnyRange | An enum that can hold any Range* type. |