pub enum HostOrSocketAddress {
UnixDomain(Box<SocketAddr>),
V4Socket(Box<SocketAddrV4>),
V6Socket(Box<SocketAddrV6>),
V4Host(Ipv4Addr),
V6Host(Ipv6Addr),
}
Expand description
Specify either a unix or IP address. The IP address can optionally include a port number
Variants§
UnixDomain(Box<SocketAddr>)
V4Socket(Box<SocketAddrV4>)
V6Socket(Box<SocketAddrV6>)
V4Host(Ipv4Addr)
V6Host(Ipv6Addr)
Implementations§
Source§impl HostOrSocketAddress
impl HostOrSocketAddress
Sourcepub fn host(&self) -> HostAddress
pub fn host(&self) -> HostAddress
Returns the “host” portion of the address
Sourcepub fn unix(&self) -> Option<UnixSocketAddr>
pub fn unix(&self) -> Option<UnixSocketAddr>
Returns the unix domain socket representation of the address
Sourcepub fn ip_and_port(&self) -> Option<SocketAddr>
pub fn ip_and_port(&self) -> Option<SocketAddr>
Returns the ip SocketAddr (including port) representation of the address
Sourcepub fn set_port_if_not_set(&mut self, port: u16)
pub fn set_port_if_not_set(&mut self, port: u16)
Assign a port number if no port is already set
Trait Implementations§
Source§impl Clone for HostOrSocketAddress
impl Clone for HostOrSocketAddress
Source§fn clone(&self) -> HostOrSocketAddress
fn clone(&self) -> HostOrSocketAddress
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for HostOrSocketAddress
impl Debug for HostOrSocketAddress
Source§impl<'de> Deserialize<'de> for HostOrSocketAddress
impl<'de> Deserialize<'de> for HostOrSocketAddress
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for HostOrSocketAddress
impl Display for HostOrSocketAddress
Source§impl From<HostAddress> for HostOrSocketAddress
impl From<HostAddress> for HostOrSocketAddress
Source§fn from(a: HostAddress) -> HostOrSocketAddress
fn from(a: HostAddress) -> HostOrSocketAddress
Converts to this type from the input type.
Source§impl From<HostOrSocketAddress> for String
impl From<HostOrSocketAddress> for String
Source§fn from(a: HostOrSocketAddress) -> String
fn from(a: HostOrSocketAddress) -> String
Converts to this type from the input type.
Source§impl From<IpAddr> for HostOrSocketAddress
impl From<IpAddr> for HostOrSocketAddress
Source§fn from(ip: IpAddr) -> HostOrSocketAddress
fn from(ip: IpAddr) -> HostOrSocketAddress
Converts to this type from the input type.
Source§impl From<Ipv4Addr> for HostOrSocketAddress
impl From<Ipv4Addr> for HostOrSocketAddress
Source§fn from(ip: Ipv4Addr) -> HostOrSocketAddress
fn from(ip: Ipv4Addr) -> HostOrSocketAddress
Converts to this type from the input type.
Source§impl From<Ipv6Addr> for HostOrSocketAddress
impl From<Ipv6Addr> for HostOrSocketAddress
Source§fn from(ip: Ipv6Addr) -> HostOrSocketAddress
fn from(ip: Ipv6Addr) -> HostOrSocketAddress
Converts to this type from the input type.
Source§impl From<SocketAddr> for HostOrSocketAddress
impl From<SocketAddr> for HostOrSocketAddress
Source§fn from(unix: UnixSocketAddr) -> HostOrSocketAddress
fn from(unix: UnixSocketAddr) -> HostOrSocketAddress
Converts to this type from the input type.
Source§impl From<SocketAddr> for HostOrSocketAddress
impl From<SocketAddr> for HostOrSocketAddress
Source§fn from(ip: SocketAddr) -> HostOrSocketAddress
fn from(ip: SocketAddr) -> HostOrSocketAddress
Converts to this type from the input type.
Source§impl From<SocketAddr> for HostOrSocketAddress
impl From<SocketAddr> for HostOrSocketAddress
Source§fn from(unix: SocketAddr) -> HostOrSocketAddress
fn from(unix: SocketAddr) -> HostOrSocketAddress
Converts to this type from the input type.
Source§impl From<SocketAddress> for HostOrSocketAddress
impl From<SocketAddress> for HostOrSocketAddress
Source§fn from(a: SocketAddress) -> HostOrSocketAddress
fn from(a: SocketAddress) -> HostOrSocketAddress
Converts to this type from the input type.
Source§impl FromStr for HostOrSocketAddress
impl FromStr for HostOrSocketAddress
Source§impl PartialEq for HostOrSocketAddress
impl PartialEq for HostOrSocketAddress
Source§impl Serialize for HostOrSocketAddress
impl Serialize for HostOrSocketAddress
Source§impl TryFrom<String> for HostOrSocketAddress
impl TryFrom<String> for HostOrSocketAddress
impl Eq for HostOrSocketAddress
Auto Trait Implementations§
impl Freeze for HostOrSocketAddress
impl RefUnwindSafe for HostOrSocketAddress
impl Send for HostOrSocketAddress
impl Sync for HostOrSocketAddress
impl Unpin for HostOrSocketAddress
impl UnwindSafe for HostOrSocketAddress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more