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