|
@@ -8,10 +8,12 @@ use std::cmp::Eq;
|
|
|
use std::collections::HashMap;
|
|
|
use std::hash::Hash;
|
|
|
|
|
|
+use serde::{Deserialize, Serialize};
|
|
|
+
|
|
|
/// Each instance of DupFilter maintains its own independent table of
|
|
|
/// seen ids. IdType will typically be Scalar.
|
|
|
-#[derive(Default, Debug)]
|
|
|
-pub struct DupFilter<IdType> {
|
|
|
+#[derive(Default, Debug, Serialize, Deserialize)]
|
|
|
+pub struct DupFilter<IdType: Hash + Eq + Copy + Serialize> {
|
|
|
seen_table: HashMap<IdType, ()>,
|
|
|
}
|
|
|
|
|
@@ -23,7 +25,7 @@ pub enum SeenType {
|
|
|
Seen,
|
|
|
}
|
|
|
|
|
|
-impl<IdType: Hash + Eq + Copy> DupFilter<IdType> {
|
|
|
+impl<IdType: Hash + Eq + Copy + Serialize> DupFilter<IdType> {
|
|
|
/// Check to see if the id is in the seen table, but do not add it
|
|
|
/// to the seen table. Return Seen if it is already in the table,
|
|
|
/// Fresh if not.
|