Closed gituser-rs closed 5 months ago
I briefly looked into https://doc.rust-lang.org/std/collections/hash_map/struct.OccupiedEntry.html
, and found that std
didn't implement any deref*
methods. Unlike dashmap
, the entry API of SCC
is almost identical to that of std
, and I'm reluctant to add a Deref
implementation to OccupiedEntry
of scc::HashMap
. Let me think about this and look into other crates for a couple of days, and get back to you.
I briefly looked into
https://doc.rust-lang.org/std/collections/hash_map/struct.OccupiedEntry.html
, and found thatstd
didn't implement anyderef*
methods. Unlikedashmap
, the entry API ofSCC
is almost identical to that ofstd
, and I'm reluctant to add aDeref
implementation toOccupiedEntry
ofscc::HashMap
. Let me think about this and look into other crates for a couple of days, and get back to you.
How about making it as an optional feature? std HashMap::get
returns reference to value but SCC HashMap::get
returns OccupiedEntry, so you need to call get() again.
Hm... HashMap::get
returning Option<V>
justifies your request to some extent.
OK, it looks to be reasonable to add a deref impl to OccupiedEntry. The PR will be approved after tests.
Thanks for such a good project.
There is one thing that could make it better. Dashmap gives access to struct fields in the same way as references (through Ref struct).
Here is how it works in dashmap:
Same but using scc:
It's not very convenient to use it like this. Would be nice to have the same usage as in dashmap