summaryrefslogtreecommitdiff
path: root/ecs/src/util/array_vec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/util/array_vec.rs')
-rw-r--r--ecs/src/util/array_vec.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/ecs/src/util/array_vec.rs b/ecs/src/util/array_vec.rs
index 13a0349..a37b1f9 100644
--- a/ecs/src/util/array_vec.rs
+++ b/ecs/src/util/array_vec.rs
@@ -115,3 +115,17 @@ impl<Item, const CAPACITY: usize> Default for ArrayVec<Item, CAPACITY>
}
}
}
+
+impl<Item, const CAPACITY: usize> Drop for ArrayVec<Item, CAPACITY>
+{
+ fn drop(&mut self)
+ {
+ for item in &mut self.items[..self.len] {
+ // SAFETY: The items from index 0 to the length index will always be
+ // initialized and satisfy all the invariants of the Item type.
+ unsafe {
+ item.assume_init_drop();
+ }
+ }
+ }
+}