Show the crate…

4 releases (2 breaking)

0.11.1 Jun 8, 2021
0.11.0 Feb 18, 2021
0.10.0 Mar 10, 2021
0.8.0 Feb 20, 2021

#9 in #vapory

Download history 145/week @ 2024-07-25 130/week @ 2024-08-01 94/week @ 2024-08-08 84/week @ 2024-08-15 100/week @ 2024-08-22 140/week @ 2024-08-29 77/week @ 2024-09-05 69/week @ 2024-09-12 115/week @ 2024-09-19 126/week @ 2024-09-26 116/week @ 2024-10-03 53/week @ 2024-10-10 108/week @ 2024-10-17 178/week @ 2024-10-24 126/week @ 2024-10-31 106/week @ 2024-11-07

522 downloads per month
Used in 70 crates (3 directly)

MIT/Apache

65KB
1K SLoC

use hex_literal::hex;
use vapbloom::{Bloom, Input};

use std::str::FromStr;
let bloom = Bloom::from_str(
	"00000000000000000000000000000000\
	00000000100000000000000000000000\
	00000000000000000000000000000000\
	00000000000000000000000000000000\
	00000000000000000000000000000000\
	00000000000000000000000000000000\
	00000002020000000000000000000000\
	00000000000000000000000800000000\
	10000000000000000000000000000000\
	00000000000000000000001000000000\
	00000000000000000000000000000000\
	00000000000000000000000000000000\
	00000000000000000000000000000000\
	00000000000000000000000000000000\
	00000000000000000000000000000000\
	00000000000000000000000000000000"
).unwrap();
let address = hex!("ef2d6d194084c2de36e0dabfce45d046b37d1106");
let topic = hex!("02c69be41d0b7e40352fc85be1cd65eb03d40ef8427a0ca4596b1ead9a00e9fc");

let mut my_bloom = Bloom::default();
assert!(!my_bloom.contains_input(Input::Raw(&address)));
assert!(!my_bloom.contains_input(Input::Raw(&topic)));

my_bloom.accrue(Input::Raw(&address));
assert!(my_bloom.contains_input(Input::Raw(&address)));
assert!(!my_bloom.contains_input(Input::Raw(&topic)));

my_bloom.accrue(Input::Raw(&topic));
assert!(my_bloom.contains_input(Input::Raw(&address)));
assert!(my_bloom.contains_input(Input::Raw(&topic)));
assert_eq!(my_bloom, bloom);

Dependencies

~90–670KB
~12K SLoC