@@ -12,17 +12,11 @@ use crate::Vec;
1212///
1313/// Note that as this map doesn't use hashing so most operations are **O(N)** instead of O(1)
1414
15- pub struct LinearMap < K , V , const N : usize >
16- where
17- K : Eq ,
18- {
15+ pub struct LinearMap < K , V , const N : usize > {
1916 pub ( crate ) buffer : Vec < ( K , V ) , N > ,
2017}
2118
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 > {
2620 /// Creates an empty `LinearMap`
2721 ///
2822 /// # Examples
3933 pub const fn new ( ) -> Self {
4034 Self { buffer : Vec :: new ( ) }
4135 }
36+ }
4237
38+ impl < K , V , const N : usize > LinearMap < K , V , N >
39+ where
40+ K : Eq ,
41+ {
4342 /// Returns the number of elements that the map can hold
4443 ///
4544 /// Computes in **O(1)** time
@@ -437,25 +436,6 @@ where
437436 }
438437}
439438
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-
459439impl < ' a , K , V , const N : usize > IntoIterator for & ' a LinearMap < K , V , N >
460440where
461441 K : Eq ,
@@ -488,10 +468,7 @@ impl<'a, K, V> Clone for Iter<'a, K, V> {
488468 }
489469}
490470
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 > {
495472 fn drop ( & mut self ) {
496473 // heapless::Vec implements drop right?
497474 drop ( & self . buffer ) ;
0 commit comments