rust/library/alloc/src/vec
bors 2b4196e977 Auto merge of #84111 - bstrie:hashfrom, r=joshtriplett
Stabilize `impl From<[(K, V); N]> for HashMap` (and friends)

In addition to allowing HashMap to participate in Into/From conversion, this adds the long-requested ability to use constructor-like syntax for initializing a HashMap:
```rust
let map = HashMap::from([
    (1, 2),
    (3, 4),
    (5, 6)
]);
```
This addition is highly motivated by existing precedence, e.g. it is already possible to similarly construct a Vec from a fixed-size array:
```rust
let vec = Vec::from([1, 2, 3]);
```
...and it is already possible to collect a Vec of tuples into a HashMap (and vice-versa):
```rust
let vec = Vec::from([(1, 2)]);
let map: HashMap<_, _> = vec.into_iter().collect();
let vec: Vec<(_, _)> = map.into_iter().collect();
```
...and of course it is likewise possible to collect a fixed-size array of tuples into a HashMap ([but not vice-versa just yet](https://github.com/rust-lang/rust/issues/81615)):
```rust
let arr = [(1, 2)];
let map: HashMap<_, _> = std::array::IntoIter::new(arr).collect();
```
Therefore this addition seems like a no-brainer.

As for any impl, this would be insta-stable.
2021-07-24 22:31:14 +00:00
..
cow.rs Document From impls for cow.rs 2021-05-26 14:21:44 +00:00
drain.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
drain_filter.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
in_place_drop.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
into_iter.rs Add doc(hidden) to all __iterator_get_unchecked 2021-06-16 22:08:44 -07:00
is_zero.rs Fix a typo 2021-05-30 00:06:27 +02:00
mod.rs Auto merge of #84111 - bstrie:hashfrom, r=joshtriplett 2021-07-24 22:31:14 +00:00
partial_eq.rs alloc: Add unstable Cfg feature no-global_oom_handling 2021-05-05 16:49:04 -04:00
set_len_on_drop.rs refactor: moved SetLenOnDrop to set_len_on_drop 2020-12-29 14:03:30 +00:00
source_iter_marker.rs Add comments around code where ordering is important due for panic-safety 2021-06-22 19:06:55 +02:00
spec_extend.rs Add comments around code where ordering is important due for panic-safety 2021-06-22 19:06:55 +02:00
spec_from_elem.rs style: applying Rust style 2020-12-29 14:03:30 +00:00
spec_from_iter.rs Update documentation of SpecFromIter to reflect the removed impls 2021-05-31 21:07:03 +02:00
spec_from_iter_nested.rs panic early when TrustedLen indicates a length > usize::MAX 2021-03-31 23:09:28 +02:00
splice.rs Update expressions where we can use array's IntoIterator implementation 2021-06-02 16:09:04 +06:00