Open
Description
Component
primitives
Describe the feature you would like
Right now alloy-primitives map::Entry
can be one of two types, the first is the default collections entry type:
https://doc.rust-lang.org/std/collections/hash_map/enum.Entry.html
Which is:
Entry<'a, K: 'a, V: 'a>
And the second is the hashbrown entry type:
https://docs.rs/hashbrown/latest/hashbrown/hash_map/enum.Entry.html
Which is:
Entry<'a, K, V, S, A = [Global](https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html)>
Note the additional S
generic - this means that if I wanted to use the maps in a struct and create an API like:
use alloy_primitives::{B256, map::{B256Map, B256Set, Entry}};
struct ContainsMap {
/// just some random private map
field: B256Map<B256Set>
}
impl ContainsMap {
fn map_entry(&mut self, key: B256) -> Entry<'_, B256, B256Set> {
self.field.entry(key)
}
}
Then I would get a compile error when the hashbrown impl is selected:
core/crates/primitives/src/map/mod.rs
Lines 37 to 49 in 8c7229d
It would be nice to make sure the exported Entry
type is usable in function signatures
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status