You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use rangemap::RangeSet (exactly what I was looking for, thanks!).
But in my case, I don't want neighboring ("adjacent") ranges to coalesce into a single range.
If the inserted range either overlaps or is immediately adjacent any existing range, then the ranges will be coalesced into a single contiguous range.
For me, it would help if I could "turn off coalescing" (or "turn off adjacent coalescing") for some rangemap instances (RangeMap, RangeSet, etc.).
Ideally, this would be set at initialization time.
Another option is to allow something like my_rangemap.coalesce = false but require it be done before any modifying operations like insert, otherwise panic!.
Thanks for creating this crate!
The text was updated successfully, but these errors were encountered:
I'm unlikely to support non-coalescing use cases in the rangemap crate itself. (Never say never, though; maybe I'll come to understand the use cases for them and find them super-compelling. 🤷♂️)
If you're okay with a teensy bit of extra overhead, my suggestion would be to make your own wrapper similar to how RangeSet wraps RangeMap, and have every key added always map to a unique value. E.g. (in pseudo-Rust)
Then adjacent/overlapping ranges will never be coalesced.
My hesitance to support this in-crate is because the coalescing logic is woven through the rest; it's not really possible to neatly separate it and just toggle it on and off. And I'm concerned that the implementation of this crate is already complex enough, so for now I want to avoid supporting anything I don't see as a "core use case", if that makes sense. One day hopefully we'll get a cursor API for BTreeMap, and all of this will become a lot simpler and faster. 😀
I'm trying to use
rangemap::RangeSet
(exactly what I was looking for, thanks!).But in my case, I don't want neighboring ("adjacent") ranges to coalesce into a single range.
From the docs
For me, it would help if I could "turn off coalescing" (or "turn off adjacent coalescing") for some
rangemap
instances (RangeMap
,RangeSet
, etc.).Ideally, this would be set at initialization time.
Another option is to allow something like
my_rangemap.coalesce = false
but require it be done before any modifying operations likeinsert
, otherwisepanic!
.Thanks for creating this crate!
The text was updated successfully, but these errors were encountered: