diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -22,7 +22,6 @@ use std::net::IpAddr; use std::result::Result; use std::str::FromStr; -#[derive(Deserialize)] pub struct PhishTank { pub phishes: Vec<Phish>, } @@ -60,6 +59,13 @@ pub fn load_phistank<R: BufRead>(input: R) -> Result<PhishTank, io::Error> { Ok(PhishTank { phishes }) } + +impl PhishTank { + pub fn is_phish(&self, url: &str) -> bool { + self.phishes.iter().find(|phish| phish.url == url).is_some() + } +} + // Helper function to deserialize a number represented as a string. // // The PhishTank dataset represents numbers this way, so the default |