map_try_insert changes#155360
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
9faa93f to
63ad76d
Compare
A PR to update https://github.com/rust-lang/hashbrown may be needed first to make |
|
Okay, I will keep this PR a draft for now. |
This comment has been minimized.
This comment has been minimized.
|
This is a test. It won't compile right now since I was using a local build of hashbrown. Let me know what you think. |
This comment has been minimized.
This comment has been minimized.
|
Originally I was thinking that I guess I'll re-nominate for @rust-lang/libs-api because there's a tradeoff here. Question: is there any interest in something like this as an alternative to putting the key in the pub struct OccupiedEntry<...> {
hash: u64,
elem: Bucket<(K, V)>,
table: &'a mut HashMap<K, V, S, A>,
original_key: Option<K>, // new field
}
impl<...> OccupiedEntry<...> {
fn original_key(&mut self) -> &mut Option<K>;
}The advantage is that users can get the unused owned @rustbot label +I-libs-api-nominated @malezjaa in the meantime feel free to open the HashBrown PR, and please add tests that the key is actually present when expected. |
|
Personally storing the key on It's true that |
|
I don't think that |
|
r? Amanieu Agreed that it's not very optimal to hold the key in the entry so I'll unnominate. |
42e6473 to
1971bcf
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot)For more information how to resolve CI failures of this job, visit this link. |
|
Maybe I should keep this as a draft until new version of hashbrown gets released? |
Made changes according to #82766 (comment).
The only thing I wasn't sure about was adding Clone bound to key, even though I think this is the only way to do that, because .entry() consumes the key.
r? @tgross35