| Crates.io | closed-interval-set |
| lib.rs | closed-interval-set |
| version | 1.7.0 |
| created_at | 2025-02-09 20:56:41.729362+00 |
| updated_at | 2025-03-02 20:59:07.211026+00 |
| description | Unions of closed intervals as containers of pairs |
| homepage | |
| repository | https://github.com/pkhuong/closed-interval-set |
| max_upload_size | |
| id | 1549272 |
| size | 150,200 |
Real documentation on docs.rs.
There's a plethora of crates that manipulate sets of values represented as sets of intervals. This crate targets what appears to be a gap in the current (February 2025) offering:
[T::MIN, T::MAX]The closed-interval-set crate offers all that, for arbitrary types
that implement its Endpoint trait, and comes with an implementation
of that trait for the 12 standard integer types, as well as for 32 and
64 -bit floats.
The crate is designed for usage patterns where sets are constructed
ahead of time (perhaps by combining different sets together), then
frozen (as SmallVec<[(T, T); 2]>, internally) for read-only access.
However, its iterator implementations of set complementation, union,
and intersection are closed over the NormalizedRangeIter trait, so
it's feasible to build up complex, even type-erased, expression before
materializing the result to a RangeVec.
normalize_interval : same idea of normalizing integer ranges to closed intervals.
Many crates can handle the more complex case where we wish to track overlapping ranges individually (e.g., iset, or nested_intervals).
The range-set-blaze is similar to this crate, and intervallum even closer, but neither handles the full range of u128 or i128.