`Eq` requirement for `V`
rongcuid opened this issue · comments
Is Eq
really needed for the value type? Std maps like HashMap
and BTreeMap
does not pose any assumptions on the values except when implementing PartialEq
and Eq
, respectively.
I think it's needed for the insert()
method to decide whether to coalesce adjacent or overlapping ranges. Which doesn't apply to BTreeMap
or HashMap
.
But what about values that don't implement Eq
? Implementation aside, would it still be a valid range map?
You could indeed have a valid range map even if the value doesn't implement Eq
range_bounds_map allows this for example.
Thanks for answering this, @ripytide.
I do plan to make coalescing (and therefore the Eq
bound) opt-in eventually, but I can't promise any timelines at the moment.
Any suggestions for a temporary workaround for say, trait objects that cannot implement Eq?