summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-03-29 16:39:22 +0100
committerHampusM <hampus@hampusmat.com>2025-03-29 16:39:22 +0100
commitaf42d53f0f6f15da05488bf97b0989691259dcce (patch)
treeea8e4580bf4d00b851ad978f5c1f6389a1eba7eb
parent026a6e129ee486cd17fb17289bd3be250b7efa1c (diff)
feat: check field types in push fn
-rw-r--r--src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 25f9ab5..885f364 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -170,6 +170,14 @@ impl MultiVec
if self.capacity != 0 {
assert_eq!(fields.as_ref().len(), self.field_cnt());
+ assert!(fields
+ .as_ref()
+ .iter()
+ .zip(self.get_field_metadata().unwrap())
+ .all(|(item_field, field_metadata)| {
+ item_field.id() == field_metadata.type_id
+ }));
+
if self.capacity == self.length {
self.grow_amortized(1, &fields);
}