Skip to content

Commit 9e7ca13

Browse files
committed
Add optional serde support to SimHash and geo_filters crate
1 parent ee0f306 commit 9e7ca13

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

crates/geo_filters/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bench = false
1414

1515
[features]
1616
default = []
17+
serde = ["dep:serde"]
1718
evaluation = [
1819
"dep:clap",
1920
"dep:hyperloglogplus",
@@ -31,6 +32,7 @@ once_cell = "1.18"
3132
rand = { version = "0.9", optional = true }
3233
rayon = { version = "1.7", optional = true }
3334
regex = { version = "1", optional = true }
35+
serde = { version = "1.0", default-features = false, optional = true }
3436

3537
[dev-dependencies]
3638
criterion = "0.7"

crates/geo_filters/src/diff_count/sim_hash.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub type BucketId = usize;
2121
/// SimHash is a hash computed over a continuous range of bits from a GeoDiffCount.
2222
/// It is used to quickly find similar sets with a reverse index.
2323
#[derive(Copy, Clone, Default, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
24+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
25+
#[cfg_attr(feature = "serde", serde(transparent))]
2426
pub struct SimHash(pub u64);
2527

2628
impl SimHash {

0 commit comments

Comments
 (0)