From: Yann Dirson Date: Mon, 20 Nov 2023 14:52:07 +0000 (+0100) Subject: pnet: use a NetworkView type alias to reduce redundancy X-Git-Tag: 0.3.0~11^2~17 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d625cc37eff8a604c0dca4a0e1b6e1ea65ca687c;p=xen-guest-agent.git pnet: use a NetworkView type alias to reduce redundancy Signed-off-by: Yann Dirson --- diff --git a/src/collector_net_pnet.rs b/src/collector_net_pnet.rs index 23b99db..97de8f5 100644 --- a/src/collector_net_pnet.rs +++ b/src/collector_net_pnet.rs @@ -15,8 +15,9 @@ enum Address { IP(IpNetwork), MAC(MacAddr), } +type NetworkView = HashMap>; pub struct NetworkSource { - cache: HashMap>, + cache: NetworkView, } impl NetworkSource { @@ -45,7 +46,7 @@ impl NetworkSource { let network_interfaces = pnet_datalink::interfaces(); // get a full view of interfaces, diffable with the cache - let mut network_view: HashMap> = HashMap::new(); + let mut network_view: NetworkView = HashMap::new(); for iface in network_interfaces.iter() { // KLUDGE: drop ":alias" suffix for Linux interface aliases let name = iface.name.split(":").next().unwrap_or(&iface.name);