manycastr/cli/writer/
catchment_row.rs1use crate::SINGLE_ORIGIN;
2use crate::custom_module::manycastr::MeasurementReply;
3use bimap::BiHashMap;
4
5pub fn get_catchment_csv_row(
16 reply: MeasurementReply,
17 rx_id: &u32,
18 worker_map: &BiHashMap<u32, String>,
19 origin_id: u32,
20) -> Vec<String> {
21 let rx_hostname = worker_map
23 .get_by_left(rx_id)
24 .unwrap_or(&String::from("Unknown"))
25 .to_string();
26
27 let mut row = vec![
28 rx_hostname,
29 reply.src.unwrap().to_string(),
30 reply.ttl.to_string(),
31 ];
32
33 if let Some(chaos) = reply.chaos {
35 row.push(chaos.to_string());
36 }
37 if origin_id != SINGLE_ORIGIN {
38 row.push(origin_id.to_string());
39 }
40
41 row
42}