MCPcopy Create free account
hub / github.com/cosdata/cosdata / deserialize

Method deserialize

src/config_loader.rs:82–91  ·  view source on GitHub ↗
(d: D)

Source from the content-addressed store, hash-verified

80
81impl<'de> Deserialize<'de> for Host {
82 fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
83 let s = String::deserialize(d)?;
84 if let Ok(address) = &s.parse::<Ipv6Addr>() {
85 return Ok(Host::Ip(IpAddr::V6(*address)));
86 }
87 if let Ok(address) = &s.parse::<Ipv4Addr>() {
88 return Ok(Host::Ip(IpAddr::V4(*address)));
89 }
90 Ok(Host::Hostname(s))
91 }
92}
93
94// Custom type for Port

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected