|
1 | 1 | use super::{IntoIter, VecDeque};
|
2 |
| -use crate::alloc::Allocator; |
| 2 | +use crate::Global; |
3 | 3 | use core::alloc;
|
4 | 4 |
|
5 | 5 | /// Specialization trait used for `VecDeque::from_iter`
|
6 | 6 | pub(super) trait SpecFromIter<T, I> {
|
7 | 7 | fn spec_from_iter(iter: I) -> Self;
|
8 | 8 | }
|
9 | 9 |
|
10 |
| -impl<T, I, A: Allocator, const COOP_PREFERRED: bool> SpecFromIter<T, I> |
11 |
| - for VecDeque<T, A, COOP_PREFERRED> |
| 10 | +impl<T, I, const COOP_PREFERRED: bool> SpecFromIter<T, I> |
| 11 | + for VecDeque<T, Global, COOP_PREFERRED> |
12 | 12 | where
|
13 | 13 | I: Iterator<Item = T>,
|
14 |
| - [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRED)]:, |
| 14 | + [(); alloc::co_alloc_metadata_num_slots_with_preference::<Global>(COOP_PREFERRED)]:, |
15 | 15 | {
|
16 | 16 | default fn spec_from_iter(iterator: I) -> Self {
|
17 | 17 | // Since converting is O(1) now, just re-use the `Vec` logic for
|
18 | 18 | // anything where we can't do something extra-special for `VecDeque`,
|
19 | 19 | // especially as that could save us some monomorphiziation work
|
20 | 20 | // if one uses the same iterators (like slice ones) with both.
|
21 |
| - crate::vec::Vec::<T, A, COOP_PREFERRED>::from_iter(iterator).into() |
| 21 | + crate::vec::Vec::<T, Global, COOP_PREFERRED>::from_iter(iterator).into() |
22 | 22 | }
|
23 | 23 | }
|
24 | 24 |
|
25 |
| -impl<T, A: Allocator, const COOP_PREFERRED: bool> SpecFromIter<T, crate::vec::IntoIter<T, A, COOP_PREFERRED>> |
26 |
| - for VecDeque<T, A, COOP_PREFERRED> |
| 25 | +impl<T, const COOP_PREFERRED: bool> SpecFromIter<T, crate::vec::IntoIter<T, Global, COOP_PREFERRED>> |
| 26 | + for VecDeque<T, Global, COOP_PREFERRED> |
27 | 27 | where
|
28 |
| - [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRED)]:, |
| 28 | + [(); alloc::co_alloc_metadata_num_slots_with_preference::<Global>(COOP_PREFERRED)]:, |
29 | 29 | {
|
30 | 30 | #[inline]
|
31 |
| - fn spec_from_iter(iterator: crate::vec::IntoIter<T, A, COOP_PREFERRED>) -> Self { |
| 31 | + fn spec_from_iter(iterator: crate::vec::IntoIter<T, Global, COOP_PREFERRED>) -> Self { |
32 | 32 | iterator.into_vecdeque()
|
33 | 33 | }
|
34 | 34 | }
|
35 | 35 |
|
36 |
| -impl<T, A: Allocator, const COOP_PREFERRED: bool> SpecFromIter<T, IntoIter<T, A, COOP_PREFERRED>> |
37 |
| - for VecDeque<T, A, COOP_PREFERRED> |
| 36 | +impl<T, const COOP_PREFERRED: bool> SpecFromIter<T, IntoIter<T, Global, COOP_PREFERRED>> |
| 37 | + for VecDeque<T, Global, COOP_PREFERRED> |
38 | 38 | where
|
39 |
| - [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRED)]:, |
| 39 | + [(); alloc::co_alloc_metadata_num_slots_with_preference::<Global>(COOP_PREFERRED)]:, |
40 | 40 | {
|
41 | 41 | #[inline]
|
42 |
| - fn spec_from_iter(iterator: IntoIter<T, A, COOP_PREFERRED>) -> Self { |
| 42 | + fn spec_from_iter(iterator: IntoIter<T, Global, COOP_PREFERRED>) -> Self { |
43 | 43 | iterator.into_vecdeque()
|
44 | 44 | }
|
45 | 45 | }
|
0 commit comments