1
1
use core:: hash:: { BuildHasher , Hash } ;
2
2
use core:: mem;
3
3
4
- use crate :: raw:: { ArrayTable , RawTable } ;
4
+ use crate :: raw:: RawTable ;
5
5
use crate :: utils;
6
6
7
7
/// A draining iterator over entries of an `ArrayMap` which do not satisfy the
@@ -11,23 +11,27 @@ use crate::utils;
11
11
/// for more.
12
12
///
13
13
/// [`ArrayMap::drain_filter`]: crate::ArrayMap::drain_filter
14
- pub struct DrainFilter < ' a , K , V , F , B : BuildHasher , const N : usize >
14
+ pub struct DrainFilter < ' a , K , V , F , R , B >
15
15
where
16
+ B : BuildHasher ,
16
17
F : FnMut ( & K , & mut V ) -> bool ,
17
18
K : Hash + Eq ,
19
+ R : RawTable < ( K , V ) > ,
18
20
{
19
21
f : F ,
20
- iter : < ArrayTable < ( K , V ) , N > as RawTable < ( K , V ) > > :: RawIter ,
21
- table : & ' a mut ArrayTable < ( K , V ) , N > ,
22
+ iter : R :: RawIter ,
23
+ table : & ' a mut R ,
22
24
build_hasher : & ' a B ,
23
25
}
24
26
25
- impl < ' a , K , V , F , B : BuildHasher , const N : usize > DrainFilter < ' a , K , V , F , B , N >
27
+ impl < ' a , K , V , F , R , B > DrainFilter < ' a , K , V , F , R , B >
26
28
where
29
+ B : BuildHasher ,
27
30
F : FnMut ( & K , & mut V ) -> bool ,
28
31
K : Hash + Eq ,
32
+ R : RawTable < ( K , V ) > ,
29
33
{
30
- pub ( crate ) fn new ( f : F , table : & ' a mut ArrayTable < ( K , V ) , N > , build_hasher : & ' a B ) -> Self {
34
+ pub ( crate ) fn new ( f : F , table : & ' a mut R , build_hasher : & ' a B ) -> Self {
31
35
Self {
32
36
f,
33
37
iter : table. iter ( ) ,
@@ -37,10 +41,12 @@ where
37
41
}
38
42
}
39
43
40
- impl < ' a , K , V , F , B : BuildHasher , const N : usize > Iterator for DrainFilter < ' a , K , V , F , B , N >
44
+ impl < ' a , K , V , F , R , B > Iterator for DrainFilter < ' a , K , V , F , R , B >
41
45
where
46
+ B : BuildHasher ,
42
47
F : FnMut ( & K , & mut V ) -> bool ,
43
48
K : Eq + Hash ,
49
+ R : RawTable < ( K , V ) > ,
44
50
{
45
51
type Item = ( K , V ) ;
46
52
@@ -60,11 +66,12 @@ where
60
66
}
61
67
}
62
68
63
- impl < ' a , K , V , F , B , const N : usize > Drop for DrainFilter < ' a , K , V , F , B , N >
69
+ impl < ' a , K , V , F , R , B > Drop for DrainFilter < ' a , K , V , F , R , B >
64
70
where
65
71
B : BuildHasher ,
66
72
F : FnMut ( & K , & mut V ) -> bool ,
67
73
K : Eq + Hash ,
74
+ R : RawTable < ( K , V ) > ,
68
75
{
69
76
fn drop ( & mut self ) {
70
77
self . for_each ( mem:: drop) ;
0 commit comments