1use std::net::IpAddr;
2
3#[derive(Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)]
5pub struct HostResults {
6 pub hostname: String,
8
9 pub addresses: Vec<IpAddr>,
11
12 pub aliases: Vec<String>,
14}
15
16impl From<c_ares::HostResults<'_>> for HostResults {
17 fn from(results: c_ares::HostResults) -> Self {
18 Self {
19 hostname: results.hostname().to_owned(),
20 addresses: results.addresses().collect(),
21 aliases: results
22 .aliases()
23 .map(std::borrow::ToOwned::to_owned)
24 .collect(),
25 }
26 }
27}