Skip to content

Commit 7064e6b

Browse files
committed
add versionize support for more data structures
add versionize support for VecDeque/HashMap/HashSet. Signed-off-by: Zizheng Bian <[email protected]>
1 parent e00a8b5 commit 7064e6b

File tree

4 files changed

+443
-41
lines changed

4 files changed

+443
-41
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# [Unreleased]
2+
3+
- Add versionize proc macro support for HashMap, HashSet and VecDeque.
4+
15
# v0.1.6
26

37
- Upraded vmm-sys-utils to v0.8.0

coverage_config_x86_64.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"coverage_score": 96.2, "exclude_path": "test", "crate_features": ""}
1+
{"coverage_score": 96.7, "exclude_path": "test", "crate_features": ""}

src/lib.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! `Versionize` trait is implemented for the following primitives:
1818
//! u8, u16, u32, u64, usize, i8, i16, i32, i64, isize, char, f32, f64,
1919
//! String, Vec<T>, Arrays up to 32 elements, Box<T>, Wrapping<T>, Option<T>,
20-
//! FamStructWrapper<T>, and (T, U).
20+
//! FamStructWrapper<T>, VecDeque<T>, HashMap<K, V>, HashSet<T> and (T, U).
2121
//!
2222
//! Known issues and limitations:
2323
//! - Union serialization is not supported via the `Versionize` proc macro.
@@ -59,6 +59,10 @@ pub enum VersionizeError {
5959
StringLength(usize),
6060
/// Vector length exceeded.
6161
VecLength(usize),
62+
/// HashMap length exceeded.
63+
HashMapLength(usize),
64+
/// HashSet length exceeded.
65+
HashSetLength(usize),
6266
}
6367

6468
impl std::fmt::Display for VersionizeError {
@@ -82,6 +86,18 @@ impl std::fmt::Display for VersionizeError {
8286
bad_len,
8387
primitives::MAX_VEC_SIZE
8488
),
89+
HashMapLength(bad_len) => write!(
90+
f,
91+
"HashMap of length exceeded {} > {} bytes",
92+
bad_len,
93+
primitives::MAX_HASH_MAP_LEN
94+
),
95+
HashSetLength(bad_len) => write!(
96+
f,
97+
"HashSet of length exceeded {} > {} bytes",
98+
bad_len,
99+
primitives::MAX_HASH_SET_LEN
100+
),
85101
}
86102
}
87103
}

0 commit comments

Comments
 (0)