diatom_bitmap.rs
rust
1pub struct DiatomBitmap { /* internal */ }
2
3impl DiatomBitmap {
4 // Construction
5 pub fn new(config: DiatomConfig) -> Self;
6 pub fn from_sorted(values: &[u32], config: DiatomConfig) -> Self;
7
8 // Membership
9 pub fn insert(&mut self, value: u32) -> bool;
10 pub fn contains(&self, value: u32) -> bool;
11 pub fn remove(&mut self, value: u32) -> bool;
12 pub fn insert_range(&mut self, start: u32, end: u32);
13 pub fn remove_range(&mut self, start: u32, end: u32);
14
15 // Cardinality & stats
16 pub fn cardinality(&self) -> u64; // O(1), cached
17 pub fn is_empty(&self) -> bool;
18 pub fn min(&self) -> Option<u32>;
19 pub fn max(&self) -> Option<u32>;
20 pub fn container_count(&self) -> u32;
21 pub fn thermal_counts(&self) -> (u32, u32, u32); // (hot, warm, cold)
22
23 // Set operations
24 pub fn and(&self, other: &Self) -> Self; // intersection
25 pub fn or(&self, other: &Self) -> Self; // union
26 pub fn xor(&self, other: &Self) -> Self; // symmetric difference
27 pub fn andnot(&self, other: &Self) -> Self; // difference
28 pub fn and_cardinality(&self, other: &Self) -> u64;
29 pub fn or_cardinality(&self, other: &Self) -> u64;
30
31 // Maintenance & introspection
32 pub fn tick(&mut self) -> MaintenanceReport;
33 pub fn clear(&mut self);
34 pub fn boundary_positions(&self) -> Vec<u32>;
35
36 // Iteration & serialization
37 pub fn iter(&self) -> DiatomIter;
38 pub fn to_bytes(&self) -> Vec<u8>;
39 pub fn from_bytes(data: &[u8], config: DiatomConfig) -> Result<Self, SerializeError>;
40}
41