Skip to content

Commit

Permalink
Assure K and V are Send and Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
krl committed Aug 21, 2021
1 parent b279bc2 commit 3293d4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Kristoffer Ström <kristoffer@rymdkoloni.se>",
"David Stainton <dawuud@riseup.net>"]
edition = "2018"
name = "appendix"
version = "0.2.0"
version = "0.2.1"
description = "Append-only, on-disk key-value index"
documentation = "https://docs.rs/appendix/"
keywords = ["index", "datastructure"]
Expand Down
14 changes: 12 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,18 @@ pub struct Index<K, V> {
_marker: PhantomData<(K, V)>,
}

unsafe impl<K, V> Send for Index<K, V> {}
unsafe impl<K, V> Sync for Index<K, V> {}
unsafe impl<K, V> Send for Index<K, V>
where
K: Send,
V: Send,
{
}
unsafe impl<K, V> Sync for Index<K, V>
where
K: Sync,
V: Sync,
{
}

#[derive(Debug)]
#[repr(C)]
Expand Down

0 comments on commit 3293d4c

Please sign in to comment.