Another solution is to use the indexmap crate, and impl Equivalent<Key> for KeyRef.
impl Equivalent<Key> for KeyRef