1use std::ops::AddAssign;
2
3#[derive(Default, Debug)]
4pub struct BucketStats {
6 pub branch_page_n: usize, pub branch_overflow_n: usize, pub leaf_page_n: usize, pub leaf_overflow_n: usize, pub key_n: usize, pub depth: usize, pub branch_alloc: usize, pub branch_in_use: usize, pub leaf_alloc: usize, pub leaf_in_use: usize, pub bucket_n: usize, pub inline_bucket_n: usize, pub inline_bucket_in_use: usize, }
27
28impl AddAssign for BucketStats {
29 fn add_assign(&mut self, other: BucketStats) {
30 self.branch_page_n += other.branch_page_n;
31 self.branch_overflow_n += other.branch_overflow_n;
32 self.leaf_page_n += other.leaf_page_n;
33 self.leaf_overflow_n += other.leaf_overflow_n;
34 self.key_n += other.key_n;
35 if self.depth < other.depth {
36 self.depth = other.depth;
37 };
38 self.branch_alloc += other.branch_alloc;
39 self.branch_in_use += other.branch_in_use;
40 self.leaf_alloc += other.leaf_alloc;
41 self.leaf_in_use += other.leaf_in_use;
42
43 self.bucket_n += other.bucket_n;
44 self.inline_bucket_n += other.inline_bucket_n;
45 self.inline_bucket_in_use += other.inline_bucket_in_use;
46 }
47}