Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/hyperloglog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<H, B>
where
H: Hash + ?Sized,
Expand All @@ -54,6 +54,22 @@ where
phantom: PhantomData<H>,
}

impl<H, B> Clone for HyperLogLogPF<H, B>
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<H, B> HyperLogLogPF<H, B>
where
H: Hash + ?Sized,
Expand Down
20 changes: 19 additions & 1 deletion src/hyperloglogplus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<H, B>
where
H: Hash + ?Sized,
Expand All @@ -68,6 +68,24 @@ where
phantom: PhantomData<H>,
}

impl<H, B> Clone for HyperLogLogPlus<H, B>
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<H, B> HyperLogLogPlus<H, B>
where
H: Hash + ?Sized,
Expand Down