@@ -12,17 +12,11 @@ use crate::Vec;
12
12
///
13
13
/// Note that as this map doesn't use hashing so most operations are **O(N)** instead of O(1)
14
14
15
- pub struct LinearMap < K , V , const N : usize >
16
- where
17
- K : Eq ,
18
- {
15
+ pub struct LinearMap < K , V , const N : usize > {
19
16
pub ( crate ) buffer : Vec < ( K , V ) , N > ,
20
17
}
21
18
22
- impl < K , V , const N : usize > LinearMap < K , V , N >
23
- where
24
- K : Eq ,
25
- {
19
+ impl < K , V , const N : usize > LinearMap < K , V , N > {
26
20
/// Creates an empty `LinearMap`
27
21
///
28
22
/// # Examples
39
33
pub const fn new ( ) -> Self {
40
34
Self { buffer : Vec :: new ( ) }
41
35
}
36
+ }
42
37
38
+ impl < K , V , const N : usize > LinearMap < K , V , N >
39
+ where
40
+ K : Eq ,
41
+ {
43
42
/// Returns the number of elements that the map can hold
44
43
///
45
44
/// Computes in **O(1)** time
@@ -437,25 +436,6 @@ where
437
436
}
438
437
}
439
438
440
- // TODO: Why is this needed at all, no example, no test... I don't get it
441
- // impl<K, V, const N: usize> IntoIterator for LinearMap<K, V, N>
442
- // where
443
- // K: Eq,
444
- // {
445
- // type Item = (K, V);
446
- // type IntoIter = IntoIter<K, V, N>;
447
-
448
- // fn into_iter(mut self) -> Self::IntoIter {
449
- // // FIXME this may result in a memcpy at runtime
450
- // let lm = mem::replace(&mut self, unsafe { MaybeUninit::uninit().assume_init() });
451
- // mem::forget(self);
452
-
453
- // Self::IntoIter {
454
- // inner: lm.buffer.into_iter(),
455
- // }
456
- // }
457
- // }
458
-
459
439
impl < ' a , K , V , const N : usize > IntoIterator for & ' a LinearMap < K , V , N >
460
440
where
461
441
K : Eq ,
@@ -488,10 +468,7 @@ impl<'a, K, V> Clone for Iter<'a, K, V> {
488
468
}
489
469
}
490
470
491
- impl < K , V , const N : usize > Drop for LinearMap < K , V , N >
492
- where
493
- K : Eq ,
494
- {
471
+ impl < K , V , const N : usize > Drop for LinearMap < K , V , N > {
495
472
fn drop ( & mut self ) {
496
473
// heapless::Vec implements drop right?
497
474
drop ( & self . buffer ) ;
0 commit comments