Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add versionize support for more data structures #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# [Unreleased]

- Add versionize proc macro support for HashMap, HashSet and VecDeque.

# v0.1.9

- Implement Versionize for i128 and u128
Expand Down
2 changes: 1 addition & 1 deletion coverage_config_aarch64.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"coverage_score": 92.4, "exclude_path": "test", "crate_features": ""}
{"coverage_score": 90.9, "exclude_path": "test", "crate_features": ""}
2 changes: 1 addition & 1 deletion coverage_config_x86_64.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"coverage_score": 92.4, "exclude_path": "test", "crate_features": ""}
{"coverage_score": 90.9, "exclude_path": "test", "crate_features": ""}
18 changes: 17 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! `Versionize` trait is implemented for the following primitives:
//! u8, u16, u32, u64, usize, i8, i16, i32, i64, isize, char, f32, f64,
//! String, Vec<T>, Arrays up to 32 elements, Box<T>, Wrapping<T>, Option<T>,
//! FamStructWrapper<T>, and (T, U).
//! FamStructWrapper<T>, VecDeque<T>, HashMap<K, V>, HashSet<T> and (T, U).
//!
//! Known issues and limitations:
//! - Union serialization is not supported via the `Versionize` proc macro.
Expand Down Expand Up @@ -59,6 +59,10 @@ pub enum VersionizeError {
StringLength(usize),
/// Vector length exceeded.
VecLength(usize),
/// HashMap length exceeded.
HashMapLength(usize),
/// HashSet length exceeded.
HashSetLength(usize),
}

impl std::fmt::Display for VersionizeError {
Expand All @@ -82,6 +86,18 @@ impl std::fmt::Display for VersionizeError {
bad_len,
primitives::MAX_VEC_SIZE
),
HashMapLength(bad_len) => write!(
f,
"HashMap of length exceeded {} > {} bytes",
bad_len,
primitives::MAX_HASH_MAP_LEN
),
HashSetLength(bad_len) => write!(
f,
"HashSet of length exceeded {} > {} bytes",
bad_len,
primitives::MAX_HASH_SET_LEN
),
}
}
}
Expand Down
Loading