#hash-set #round-robin #iterator #last #key #hashing #wrap

bin+lib wrappinghashset

A HashSet that remembers the last key it returned with its iterator and subsequently will wrap around and only return all of the keys once per call. This is useful if you want to use a set both via hashing, and iterate over the members as a round-robin list.

2 unstable releases

0.5.0 Apr 8, 2024
0.4.1 Apr 16, 2020

#926 in Algorithms

Download history 6/week @ 2024-07-24 3/week @ 2024-09-18 19/week @ 2024-09-25 10/week @ 2024-10-02

114 downloads per month
Used in rustygeard

Apache-2.0

9KB
194 lines

Greetings! This is a tiny library I created to allow round-robin access to a hashset. It stores an extra offset in the struct to keep track of which offset it returned last time, so that the next call to iter() will return the next item, and then only all of the rest, one time.

Please do report issues if you find them. Apologies for the lack of docs, but it pretty much works like std::collections::HashSet

No runtime deps