1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! Collectors for [`HashMap`]
//!
//! This module corresponds to [`std::collections::hash_map`].
use HashMap;
// #[cfg(feature = "unstable")]
// use std::{
// collections::hash_map::{Entry, OccupiedEntry, VacantEntry},
// hash::Hash,
// };
// #[cfg(feature = "unstable")]
// use crate::aggregate::{Group, GroupMap, OccupiedGroup, VacantGroup};
/// A collector that inserts collected items into a [`HashMap`].
/// Its [`Output`] is [`HashMap`].
///
/// This struct is created by `HashMap::into_collector()`.
///
/// [`Output`]: crate::collector::CollectorBase::Output
);
/// A collector that inserts collected items into a [`&mut HashMap`](HashMap).
/// Its [`Output`] is [`&mut HashMap`](HashMap).
///
/// This struct is created by `HashMap::collector_mut()`.
///
/// [`Output`]: crate::collector::CollectorBase::Output
&'a mut );
// #[cfg(feature = "unstable")]
// // #[cfg_attr(docsrs, doc(cfg(all(feature = "std", feature = "unstable"))))]
// impl<'a, K, V> VacantGroup for VacantEntry<'a, K, V> {
// type Key = K;
// type Value = V;
// #[inline]
// fn key(&self) -> &Self::Key {
// self.key()
// }
// #[inline]
// fn insert(self, value: Self::Value) {
// self.insert(value);
// }
// }
// #[cfg(feature = "unstable")]
// // #[cfg_attr(docsrs, doc(cfg(all(feature = "std", feature = "unstable"))))]
// impl<'a, K, V> OccupiedGroup for OccupiedEntry<'a, K, V> {
// type Key = K;
// type Value = V;
// #[inline]
// fn key(&self) -> &Self::Key {
// self.key()
// }
// #[inline]
// fn value(&self) -> &Self::Value {
// self.get()
// }
// #[inline]
// fn value_mut(&mut self) -> &mut Self::Value {
// self.get_mut()
// }
// }
// #[cfg(feature = "unstable")]
// // #[cfg_attr(docsrs, doc(cfg(all(feature = "std", feature = "unstable"))))]
// impl<K, V> GroupMap for HashMap<K, V>
// where
// K: Eq + Hash,
// {
// type Key = K;
// type Value = V;
// type Vacant<'a>
// = VacantEntry<'a, K, V>
// where
// Self: 'a;
// type Occupied<'a>
// = OccupiedEntry<'a, K, V>
// where
// Self: 'a;
// #[inline]
// fn group(&mut self, key: Self::Key) -> Group<Self::Occupied<'_>, Self::Vacant<'_>> {
// match self.entry(key) {
// Entry::Occupied(entry) => Group::Occupied(entry),
// Entry::Vacant(entry) => Group::Vacant(entry),
// }
// }
// }