Improved object serialization

This commit is contained in:
mdecimus
2025-02-23 12:22:11 +01:00
parent 4b3b158ed3
commit b7c0f8447b
118 changed files with 4666 additions and 3165 deletions

View File

@@ -6,7 +6,7 @@
use std::{borrow::Borrow, cmp::Ordering, fmt, hash::Hash};
use serde::{de::DeserializeOwned, ser::SerializeMap, Deserialize, Serialize};
use serde::{Deserialize, Serialize, de::DeserializeOwned, ser::SerializeMap};
// A map implemented using vectors
// used for small datasets of less than 20 items
@@ -56,6 +56,12 @@ impl<K: Eq + PartialEq, V> VecMap<K, V> {
self.inner.push(KeyValue { key, value });
}
#[inline(always)]
pub fn with_append(mut self, key: K, value: V) -> Self {
self.append(key, value);
self
}
#[inline(always)]
pub fn insert(&mut self, idx: usize, key: K, value: V) {
self.inner.insert(idx, KeyValue { key, value });