bloom-sol 0.0.3

Counting bloom filter, aimed for solana
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::bloom_sol::struct_def::CountingBloomFilter;
use std::hash::Hash;

impl CountingBloomFilter {
    /// Adds an item to the filter.
    pub fn insert<T: Hash>(&mut self, item: &T) {
        for index in self.get_hash_indices(item) {
            if self.boolean_counting {
                self.counters[index] = 1;
            } else {
                self.counters[index] = self.counters[index].saturating_add(1);
            }
        }
    }
}