#[derive(Debug)]
pub struct Proof {
pub text: String,
pub allowed_formats: Vec<ProofFormat>,
}
impl Proof {
pub fn new(text: &str) -> Self {
Proof {
text: text.to_string(),
allowed_formats: vec![ProofFormat::Plain, ProofFormat::Hashed],
}
}
}
#[derive(Debug)]
pub enum ProofFormat {
Plain,
Hashed,
}
pub enum ProofRelation {
Equals,
Contains,
}
pub fn find_proof_in_str(proofs: &[Proof], data: &str, relation: ProofRelation) -> bool {
proofs.iter().any(|proof| match relation {
ProofRelation::Contains => data.contains(&proof.text),
ProofRelation::Equals => data == proof.text,
})
}