diff --git a/src/hyperloglog.rs b/src/hyperloglog.rs index 6bda970..a676cc0 100644 --- a/src/hyperloglog.rs +++ b/src/hyperloglog.rs @@ -41,7 +41,7 @@ use crate::HyperLogLogError; /// algorithm", Philippe Flajolet, Éric Fusy, Olivier Gandouet and Frédéric /// Meunier.](http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf) /// -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct HyperLogLogPF where H: Hash + ?Sized, @@ -54,6 +54,22 @@ where phantom: PhantomData, } +impl Clone for HyperLogLogPF +where + H: Hash + ?Sized, + B: BuildHasher + Clone, +{ + fn clone(&self) -> Self { + Self { + builder: self.builder.clone(), + count: self.count, + precision: self.precision, + registers: self.registers.clone(), + phantom: self.phantom, + } + } +} + impl HyperLogLogPF where H: Hash + ?Sized, diff --git a/src/hyperloglogplus.rs b/src/hyperloglogplus.rs index 9264ced..f06dc0d 100644 --- a/src/hyperloglogplus.rs +++ b/src/hyperloglogplus.rs @@ -53,7 +53,7 @@ use crate::HyperLogLogError; /// of the Art Cardinality Estimation Algorithm", Stefan Heule, Marc /// Nunkesser and Alexander Hall.](https://goo.gl/iU8Ig) /// -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct HyperLogLogPlus where H: Hash + ?Sized, @@ -68,6 +68,24 @@ where phantom: PhantomData, } +impl Clone for HyperLogLogPlus +where + H: Hash + ?Sized, + B: BuildHasher + Clone, +{ + fn clone(&self) -> Self { + Self { + builder: self.builder.clone(), + precision: self.precision, + counts: self.counts, + tmpset: self.tmpset.clone(), + sparse: self.sparse.clone(), + registers: self.registers.clone(), + phantom: self.phantom, + } + } +} + impl HyperLogLogPlus where H: Hash + ?Sized,