Skip to content

KeyedVecSet to support Vec<V> when V already includes K #47

@youknowone

Description

@youknowone

Description

Hi, I forked this project a while ago (I accidently opened #29) and implemented KeyedVecSet, which is a generalized version of VecSet or VecMap.

https://github.com/youknowone/vecset-rs/blob/main/src/keyed.rs#L46-L53

KeyedVecSet<K, V> is represented as Vec<V>, but V implements Keyed<K> to provide ability to retrieve K from V.

VecMap<K, V> is a specialized case of KeyedVecSet<K, (K, V)> when fn keyed(v: (K, V)) -> K. And VecSet<K> is a specialized case of KeyedVecSet<K, K>.

I had a use case of vectors which has key in the middle of the data. And this feature worked well for my use case for a while.

If you are interested in this feature, I'd like to contribute this feature back to vecmap-rs again.

Thanks for making a good project!

Additional Information

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions