struct HostStats { stats : HashMap, } impl HostStats { fn get (& self , hostname : & str , port : u16 ) -> Option<&Stats;> { self .stats.
get (&Host;{ hostname: hostname.
to_string (), port, }) } fn record (& mut self , hostname : String, port : u16 , sent : usize , errors : usize ) { let host = Host { hostname, port, }; self .stats.
get (&host;) } fn record (& mut self , hostname : String, port : u16 , sent : usize , errors : usize ) { let host = Host { hostname: Cow::from(hostname), port, }; self .stats.
impl HostStats { fn try_record (& mut self , hostname : & str , port : u16 , sent : usize , errors : usize ) { let host = Host { hostname: Cow::from(hostname), port, }; if let Some(stats)…