diff options
Diffstat (limited to 'net/src')
-rw-r--r-- | net/src/endpoint.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/src/endpoint.rs b/net/src/endpoint.rs index 5aebdf9..9fb949b 100644 --- a/net/src/endpoint.rs +++ b/net/src/endpoint.rs @@ -9,6 +9,9 @@ use std::os::unix::net::SocketAddr as UnixSocketAddr; use bincode::{Decode, Encode}; use url::Url; +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; + use crate::{Error, Result}; /// Port defined as a u16. @@ -31,6 +34,7 @@ pub type Port = u16; /// ``` /// #[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum Endpoint { Udp(Addr, Port), Tcp(Addr, Port), @@ -200,6 +204,7 @@ impl Endpoint { /// Addr defines a type for an address, either IP or domain. #[derive(Debug, Clone, PartialEq, Eq, Hash, Encode, Decode)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum Addr { Ip(IpAddr), Domain(String), |