Enum message_io::network::RemoteAddr
source · pub enum RemoteAddr {
Socket(SocketAddr),
Str(String),
}Expand description
An struct that contains a remote address.
It can be Either, a SocketAddr as usual or a String used for protocols
that needs more than a SocketAddr to get connected (e.g. WebSocket)
It is usually used in
NetworkController::connect()
to specify the remote address.
Variants§
Socket(SocketAddr)
Str(String)
Implementations§
source§impl RemoteAddr
impl RemoteAddr
sourcepub fn is_socket_addr(&self) -> bool
pub fn is_socket_addr(&self) -> bool
Check if the RemoteAddr is a SocketAddr.
sourcepub fn socket_addr(&self) -> &SocketAddr
pub fn socket_addr(&self) -> &SocketAddr
Extract the SocketAddr.
This function panics if the RemoteAddr do not represent a SocketAddr.
Trait Implementations§
source§impl Clone for RemoteAddr
impl Clone for RemoteAddr
source§fn clone(&self) -> RemoteAddr
fn clone(&self) -> RemoteAddr
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 RemoteAddr
impl Debug for RemoteAddr
source§impl<'de> Deserialize<'de> for RemoteAddr
impl<'de> Deserialize<'de> for RemoteAddr
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 RemoteAddr
impl Display for RemoteAddr
source§impl Hash for RemoteAddr
impl Hash for RemoteAddr
source§impl PartialEq<RemoteAddr> for RemoteAddr
impl PartialEq<RemoteAddr> for RemoteAddr
source§fn eq(&self, other: &RemoteAddr) -> bool
fn eq(&self, other: &RemoteAddr) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for RemoteAddr
impl Serialize for RemoteAddr
source§impl ToRemoteAddr for RemoteAddr
impl ToRemoteAddr for RemoteAddr
fn to_remote_addr(&self) -> Result<RemoteAddr>
source§impl ToSocketAddrs for RemoteAddr
impl ToSocketAddrs for RemoteAddr
§type Iter = IntoIter<SocketAddr>
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond
to.
source§fn to_socket_addrs(&self) -> Result<Self::Iter>
fn to_socket_addrs(&self) -> Result<Self::Iter>
Converts this object to an iterator of resolved
SocketAddrs. Read more