Skip to content

Commit 3a7d2bc

Browse files
roypatdianpopa
authored andcommitted
Fix VersionMap no longer being Send+Sync
I overlooked that e00a8b5 was not part of 0.1.6 and introduced a breaking change, as the `dyn VersionFilter` field prevented `VersionMap` from being sharable between threads. As this was previously the case, this meant a breaking change snuck into a patch release, so 0.1.7 was yanked and instead we need to release 0.1.8 Signed-off-by: Patrick Roy <[email protected]>
1 parent ffd8152 commit 3a7d2bc

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "versionize"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
license = "Apache-2.0"
55
authors = ["Amazon Firecracker team <[email protected]>"]
66
description = "A version tolerant serialization/deserialization framework."

src/version_map.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl VersionFilter for () {
8383
#[derive(Clone, Debug)]
8484
pub struct VersionMap {
8585
versions: Vec<HashMap<TypeId, u16>>,
86-
filter: Arc<dyn VersionFilter>,
86+
filter: Arc<dyn VersionFilter + Send + Sync>,
8787
}
8888

8989
impl Default for VersionMap {
@@ -102,7 +102,7 @@ impl VersionMap {
102102
}
103103

104104
/// Create a new version map with specified version filter.
105-
pub fn with_filter(filter: Arc<dyn VersionFilter>) -> Self {
105+
pub fn with_filter(filter: Arc<dyn VersionFilter + Send + Sync>) -> Self {
106106
VersionMap {
107107
versions: vec![HashMap::new(); 1],
108108
filter,
@@ -220,6 +220,13 @@ mod tests {
220220
}
221221
}
222222

223+
#[test]
224+
fn test_version_map_is_send_and_sync() {
225+
fn assert_send_sync<T: Send + Sync>() {}
226+
227+
assert_send_sync::<VersionMap>();
228+
}
229+
223230
#[test]
224231
fn test_app_versions_with_gap() {
225232
let my_type_id = TypeId::of::<MyType>();

0 commit comments

Comments
 (0)