Skip to content

Commit

Permalink
feat: skip serialising unused field
Browse files Browse the repository at this point in the history
Changes the serialised representation to skip encoding the always null
"_key_type" field, which exists only to constrain the data type the
filter encodes in code, rather than holding any meaningful state.
  • Loading branch information
domodwyer committed Dec 19, 2024
1 parent d87e75d commit 2b51a51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/bloom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ where
hasher: H,
bitmap: B,
key_size: FilterSize,

#[cfg_attr(feature = "serde", serde(skip))]
_key_type: PhantomData<T>,
}

Expand Down
3 changes: 1 addition & 2 deletions tests/fixtures/compressed_bitmap.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
],
"max_key": 256
},
"key_size": "KeyBytes1",
"_key_type": null
"key_size": "KeyBytes1"
}

0 comments on commit 2b51a51

Please sign in to comment.