Open Jupeyy opened 1 year ago
Yeah, having this API makes sense to me, so this would be a good addition.
I haven't reviewed the PR super thoroughly yet, but I don't see at a glance why IterAtKey
and IterMutAtKey
need to contain an inner iter
field? They only seem to use the Iter::tail
field?
Also there seems to be a lot of infrastructure added via RawEntryBuilder
for methods that aren't public and only end up being used in one place, I'm not sure all of that is necessary?
Also I think I'd prefer IterAtKeyMut
rather than IterMutAtKey
to follow pattern, like RawEntryBuilderMut
.
I haven't reviewed the PR super thoroughly yet, but I don't see at a glance why
IterAtKey
andIterMutAtKey
need to contain an inneriter
field? They only seem to use theIter::tail
field?
Yeah this is rather a prototype, I can clean it up, and also add it for the linked hash set, if you want to.
Also there seems to be a lot of infrastructure added via
RawEntryBuilder
for methods that aren't public and only end up being used in one place, I'm not sure all of that is necessary?
As far as i have seen, the biggest problem was that i don't have access to the Nodes in the non mutable version, it only gives me the key-value pair. I guess i can simply implement that functionality directly inside the iter_at_key
function using the map directly (since the code looked similary to what i wanted i implemented it there^^)
Also I think I'd prefer
IterAtKeyMut
rather thanIterMutAtKey
to follow pattern, likeRawEntryBuilderMut
.
alright
This implements an iterator that was starts at a specific key entry, which allows to iterate starting from this entry, instead of starting at the beginning.
My motivation for this is to be able to easily notify all entries in a queue that an entry was dropped. I use this crate to be able to quickly drop entries at any position. So basically like a queue with instant remove. Additionally I want to be able to ping entries "after" the dropped entry. All entries "before" the dropped entry are not of interest.
I am not sure if you are generally open for such a change, I currently only implemented this iterator for the linked hash map