diff options
author | hozan23 <hozan23@karyontech.net> | 2024-06-24 02:18:03 +0200 |
---|---|---|
committer | hozan23 <hozan23@karyontech.net> | 2024-06-24 02:18:03 +0200 |
commit | 135968d8f1379a6d2f32cbbc3e5b77a5f317a4d6 (patch) | |
tree | 6de19fd08ccd1fa65846090f9b4346dff5fbbd54 /net | |
parent | 06d3dd584641baa1877a261f533cdb6a30e311ad (diff) |
p2p/examples: remove redundant code
Diffstat (limited to 'net')
-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; |