#bloom #filter #scalable #serde


Scalable Bloom Filters with serde support

11 releases (5 stable)

2.0.1 Jun 26, 2021
1.0.3 Apr 3, 2021
1.0.2 Aug 17, 2020
0.2.3 Mar 29, 2020
0.2.1 Nov 3, 2019

#254 in Data structures

Download history 6670/week @ 2023-07-18 7183/week @ 2023-07-25 5693/week @ 2023-08-01 7732/week @ 2023-08-08 11424/week @ 2023-08-15 9909/week @ 2023-08-22 10669/week @ 2023-08-29 8040/week @ 2023-09-05 5492/week @ 2023-09-12 7478/week @ 2023-09-19 8093/week @ 2023-09-26 7867/week @ 2023-10-03 7119/week @ 2023-10-10 8668/week @ 2023-10-17 11669/week @ 2023-10-24 8662/week @ 2023-10-31

37,413 downloads per month
Used in 2 crates (via kip_db)

MIT license

421 lines


Growable Bloom Filters



Implementation of Scalable Bloom Filters which also provides serde serialization and deserialize.

A bloom filter lets you insert items, and then test association with contains. It's space and time efficient, at the cost of false positives. In particular, if contains returns true, it may be in filter. But if contains returns false, it's definitely not in the bloom filter.

You can control the failure rate by setting desired_error_prob and est_insertions appropriately.

use growable_bloom_filter::GrowableBloom;

// Create and insert into the bloom filter
let mut gbloom = GrowableBloom::new(0.05, 1000);

// Serialize and Deserialize the bloom filter
use serde_json;

let s = serde_json::to_string(&gbloom).unwrap();
let des_gbloom: GrowableBloom = serde_json::from_str(&s).unwrap();


Bloom filters are typically used as a pre-cache to avoid expensive operations. For example, if you need to ask ten thousand servers if they have data XYZ, you could use GrowableBloom to figure out which ones do NOT have XYZ.


The (de)serialized bloom filter can be transferred and used across different platforms, independent of endianness, architecture or word size.

Note that stability is only guaranteed within the same major version of the crate.

Upgrading from 1.x to 2.x

  • Any 1.x serialized bloom filters will no longer be loadable in 2.x.
  • Minor API changes otherwise.


~26K SLoC