diff options
Diffstat (limited to 'net/src')
-rw-r--r-- | net/src/endpoint.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/src/endpoint.rs b/net/src/endpoint.rs index 9fb949b..c3626ec 100644 --- a/net/src/endpoint.rs +++ b/net/src/endpoint.rs @@ -35,6 +35,7 @@ pub type Port = u16; /// #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", serde(into = "String"))] pub enum Endpoint { Udp(Addr, Port), Tcp(Addr, Port), @@ -68,6 +69,11 @@ impl std::fmt::Display for Endpoint { } } } +impl From<Endpoint> for String { + fn from(endpoint: Endpoint) -> String { + endpoint.to_string() + } +} impl TryFrom<Endpoint> for SocketAddr { type Error = Error; |