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

#11 in #vapory

Download history 99/week @ 2024-04-08 150/week @ 2024-04-15 129/week @ 2024-04-22 83/week @ 2024-04-29 91/week @ 2024-05-06 135/week @ 2024-05-13 92/week @ 2024-05-20 111/week @ 2024-05-27 81/week @ 2024-06-03 87/week @ 2024-06-10 77/week @ 2024-06-17 140/week @ 2024-06-24 20/week @ 2024-07-01 56/week @ 2024-07-08 161/week @ 2024-07-15 81/week @ 2024-07-22

347 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

~91–660KB
~12K SLoC