marcusklaas / sortedvec

Rust vector types without dependencies that enable quick lookups

Home Page:https://crates.io/crates/sortedvec/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Explain why we need a macro and a parameterized struct is problematic

marcusklaas opened this issue · comments

After coming back to this repository after a long (2+ years), I found myself wondering for an embarrassing amount of time: why can't we just solve this generics instead? Slowly it came back to me that a generic key function does work indeed, but since function types cannot be made concrete, this makes for very awkward handling of the resulting struct. Everything that touches the struct must be parametrized over this key function.

Surely others may wonder the same, so we best explain what problem this crate is actually solving upfront in the readme.