aisd_lab/libtree/src/lib.rs

32 lines
606 B
Rust

mod binary_search_tree;
mod red_black_tree;
mod splay_tree;
pub use binary_search_tree::*;
pub use red_black_tree::*;
pub use splay_tree::*;
#[derive(Clone, Default)]
pub struct Stats {
pub comparisons: u64,
pub reads: u64,
pub writes: u64,
}
impl Stats {
pub fn new() -> Stats {
Self {
comparisons: 0,
reads: 0,
writes: 0,
}
}
}
impl std::ops::AddAssign for Stats {
fn add_assign(&mut self, rhs: Self) {
self.comparisons += rhs.comparisons;
self.reads += rhs.reads;
self.writes += rhs.writes;
}
}