use crate::BridgeInfo; use std::collections::HashSet; /// Provides a function for predicting which countries block this bridge pub trait Analyzer { fn blocked_in(&self, bridge_info: &BridgeInfo, confidence: f64) -> HashSet; } pub struct ExampleAnalyzer {} /// Dummy example which just tells us about blockages we already know about impl Analyzer for ExampleAnalyzer { fn blocked_in(&self, bridge_info: &BridgeInfo, confidence: f64) -> HashSet { let mut blocked_in = HashSet::::new(); for (country, info) in &bridge_info.info_by_country { if info.blocked { blocked_in.insert(country.to_string()); } } blocked_in } }