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