-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking for map_entry_recover_keys #34285
Comments
Specifically covers:
for both I would personally still hesitate a little on the name |
🔔 This issue is now entering a cycle-long final comment period for stabilization 🔔 Note though that the libs team isn't entirely comfortable with the name |
I somewhat like |
Sounds like a great fit to me! |
Is there any way to recover the key used in the entry from an occupied entry? That is, I'm trying to write a multimap like with the following insert definition: let mut key = (key, 0);
loop {
match self.values.entry(key) {
Entry::Vacant(e) => {
let idx = e.key().1;
e.insert(value);
return idx;
},
Entry::Occupied(e) => {
key = e.??? /* What here? */
key.1 += 1;
}
}
} I don't want to remove the key/value pair from the hash-map, I just want my key back! |
@Stebalien I believe not currently, no, but it is the subject of an RFC or two |
Got it. I just want to make sure the APIs play well together. Specifically, given that we want a way to to move keys out
impl Into<K> for Entry {}
impl Into<K> for OccupiedEntry {}
impl Into<K> for VacantEntry {} Note: I'm proposing (2) because having two different |
Hm yeah that's actually a good point about |
We can't actually write those |
The libs team discussed this recently and concluded:
As a result our conclusions were:
|
Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes rust-lang#27708 cc rust-lang#27709 Closes rust-lang#32313 Closes rust-lang#32630 Closes rust-lang#32713 Closes rust-lang#34029 Closes rust-lang#34392 Closes rust-lang#34285 Closes rust-lang#34529
std: Stabilize APIs for the 1.12 release Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes #27708 cc #27709 Closes #32313 Closes #32630 Closes #32713 Closes #34029 Closes #34392 Closes #34285 Closes #34529
Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes rust-lang#27708 cc rust-lang#27709 Closes rust-lang#32313 Closes rust-lang#32630 Closes rust-lang#32713 Closes rust-lang#34029 Closes rust-lang#34392 Closes rust-lang#34285 Closes rust-lang#34529
std: Stabilize APIs for the 1.12 release Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes #27708 cc #27709 Closes #32313 Closes #32630 Closes #32713 Closes #34029 Closes #34392 Closes #34285 Closes #34529
Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes rust-lang#27708 cc rust-lang#27709 Closes rust-lang#32313 Closes rust-lang#32630 Closes rust-lang#32713 Closes rust-lang#34029 Closes rust-lang#34392 Closes rust-lang#34285 Closes rust-lang#34529
Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes rust-lang#27708 cc rust-lang#27709 Closes rust-lang#32313 Closes rust-lang#32630 Closes rust-lang#32713 Closes rust-lang#34029 Closes rust-lang#34392 Closes rust-lang#34285 Closes rust-lang#34529
No description provided.
The text was updated successfully, but these errors were encountered: