use std::fmt::Debug;
use serde::{Serialize, de::DeserializeOwned};
pub mod invertible;
pub mod sealing;
pub trait WindowAccumulator: Clone + Debug + Default + Serialize + DeserializeOwned {
type Contribution: Clone + Debug;
type Output: Clone + Debug + PartialEq;
fn add(&mut self, contribution: &Self::Contribution);
fn remove(&mut self, contribution: &Self::Contribution);
fn remove_if_present(&mut self, contribution: &Self::Contribution) {
self.remove(contribution);
}
fn finalize(&self) -> Option<Self::Output>;
fn is_empty(&self) -> bool;
fn merge(&mut self, _other: &Self) {
unimplemented!("this accumulator does not support merge")
}
fn unmerge(&mut self, _other: &Self) {
unimplemented!("this accumulator does not support unmerge")
}
fn stamp(&self) -> Option<u64> {
None
}
}
#[cfg(test)]
mod tests;