Commit 87b8f76
committed
Support
Add an optional `hashbrown` feature that switches the underlying hash
map implementation from `std::collections` to `hashbrown` and makes
items that depend on hash maps available without `use_std` (although it
still requires and implicitly enables `use_alloc`).
This addresses the motivating use case of [rust-itertools#605][] (which is the same
use case that I am interested in) but does not implement a generic
approach as the issue suggests. [rust-itertools#901][] would be a better solution long
term and would make these changes obsolete, but the PR appears to be
stalled and I wanted a simple solution that allows using APIs like
`unique`/`unique_by` with `no_std` now.
It also partially addresses [rust-itertools#322][] because enabling this feature does
switch to *a* faster hash algorithm, it just doesn't allow to specify
which one exactly (currently the default hasher in `hashbrown` is
`foldhash`, so this is what's going to be used until/unless changed
upstream in the future).
[rust-itertools#605]: rust-itertools#605
[rust-itertools#901]: rust-itertools#901
[rust-itertools#322]: rust-itertools#322hashbrown hash maps and sets with or without use_std
1 parent 50d01b4 commit 87b8f76
File tree
6 files changed
+43
-20
lines changed- src
6 files changed
+43
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
| |||
64 | 71 | | |
65 | 72 | | |
66 | 73 | | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 77 | + | |
| 78 | + | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
| |||
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
105 | | - | |
| 112 | + | |
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
| |||
140 | 147 | | |
141 | 148 | | |
142 | 149 | | |
143 | | - | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
| |||
187 | 194 | | |
188 | 195 | | |
189 | 196 | | |
190 | | - | |
| 197 | + | |
191 | 198 | | |
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
195 | 202 | | |
196 | 203 | | |
197 | | - | |
| 204 | + | |
198 | 205 | | |
199 | 206 | | |
200 | 207 | | |
201 | | - | |
| 208 | + | |
202 | 209 | | |
203 | 210 | | |
204 | 211 | | |
| |||
1415 | 1422 | | |
1416 | 1423 | | |
1417 | 1424 | | |
1418 | | - | |
| 1425 | + | |
1419 | 1426 | | |
1420 | 1427 | | |
1421 | 1428 | | |
| |||
1441 | 1448 | | |
1442 | 1449 | | |
1443 | 1450 | | |
1444 | | - | |
| 1451 | + | |
1445 | 1452 | | |
1446 | 1453 | | |
1447 | 1454 | | |
| |||
1469 | 1476 | | |
1470 | 1477 | | |
1471 | 1478 | | |
1472 | | - | |
| 1479 | + | |
1473 | 1480 | | |
1474 | 1481 | | |
1475 | 1482 | | |
| |||
1496 | 1503 | | |
1497 | 1504 | | |
1498 | 1505 | | |
1499 | | - | |
| 1506 | + | |
1500 | 1507 | | |
1501 | 1508 | | |
1502 | 1509 | | |
| |||
3744 | 3751 | | |
3745 | 3752 | | |
3746 | 3753 | | |
3747 | | - | |
| 3754 | + | |
3748 | 3755 | | |
3749 | 3756 | | |
3750 | 3757 | | |
| |||
3780 | 3787 | | |
3781 | 3788 | | |
3782 | 3789 | | |
3783 | | - | |
| 3790 | + | |
3784 | 3791 | | |
3785 | 3792 | | |
3786 | 3793 | | |
| |||
3799 | 3806 | | |
3800 | 3807 | | |
3801 | 3808 | | |
3802 | | - | |
| 3809 | + | |
3803 | 3810 | | |
3804 | 3811 | | |
3805 | 3812 | | |
| |||
3816 | 3823 | | |
3817 | 3824 | | |
3818 | 3825 | | |
3819 | | - | |
| 3826 | + | |
3820 | 3827 | | |
3821 | 3828 | | |
3822 | 3829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
0 commit comments