Skip to content

Commit 93f5097

Browse files
committed
#79 drop implemented
1 parent 3b16b5d commit 93f5097

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ctors.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ impl<K: Clone + PartialEq, V: Clone, const N: usize> Map<K, V, N> {
4242
}
4343
}
4444

45+
impl<K: Clone + PartialEq, V: Clone, const N: usize> Drop for Map<K, V, N> {
46+
fn drop(&mut self) {
47+
for i in 0..self.next {
48+
unsafe {
49+
self.pairs[i].assume_init_drop();
50+
}
51+
}
52+
}
53+
}
54+
4555
#[cfg(test)]
4656
use anyhow::Result;
4757

@@ -66,7 +76,6 @@ fn drops_correctly() -> Result<()> {
6676
}
6777

6878
#[test]
69-
#[ignore]
7079
fn drops_keys() {
7180
use std::rc::Rc;
7281
let mut m: Map<Rc<()>, (), 8> = Map::new();
@@ -77,7 +86,6 @@ fn drops_keys() {
7786
}
7887

7988
#[test]
80-
#[ignore]
8189
fn drops_values() {
8290
use std::rc::Rc;
8391
let mut m: Map<(), Rc<()>, 8> = Map::new();

0 commit comments

Comments
 (0)