You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #535 - Amanieu:rework_entry, r=Amanieu
Rework the Entry API
The main change in this PR is that `OccupiedEntry` no longer holds the
key used in the initial `entry` call. As a result, `OccupiedEntryRef` is
no longer required since `OccupiedEntry` can be used in `EntryRef`
directly.
The following methods have been removed:
```rust
// hash_map
impl OccupiedEntry {
fn replace_entry(self, value: V) -> (K, V);
fn replace_key(self) -> K;
}
impl EntryRef {
fn and_replace_entry_with<F>(self, f: F) -> Self;
}
impl VacantEntryRef {
fn into_key(self) -> K;
}
// hash_set
impl Entry {
fn replace(self) -> T;
}
```
The following methods have been added:
```rust
impl VacantEntry {
fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, S, A>;
}
```
The following methods have their signatures changed:
```rust
impl EntryRef {
// Previously returned OccupiedEntryRef
fn insert(self, value: V) -> OccupiedEntry<'a, K, V, S, A>;
}
impl VacantEntryRef {
// Previously returned &Q
fn key(&self) -> &'b Q;
// Previously returned OccupiedEntryRef
fn insert(self, value: V) -> OccupiedEntry<'a, K, V, S, A>;
}
```
0 commit comments