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
sourceimpl 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
sourceimpl Clone for RemoteAddr
impl Clone for RemoteAddr
sourcefn clone(&self) -> RemoteAddr
fn clone(&self) -> RemoteAddr
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RemoteAddr
impl Debug for RemoteAddr
sourceimpl<'de> Deserialize<'de> for RemoteAddr
impl<'de> Deserialize<'de> for RemoteAddr
sourcefn 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
sourceimpl Display for RemoteAddr
impl Display for RemoteAddr
sourceimpl Hash for RemoteAddr
impl Hash for RemoteAddr
sourceimpl PartialEq<RemoteAddr> for RemoteAddr
impl PartialEq<RemoteAddr> for RemoteAddr
sourcefn 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 ==
. Read more
sourcefn ne(&self, other: &RemoteAddr) -> bool
fn ne(&self, other: &RemoteAddr) -> bool
This method tests for !=
.
sourceimpl Serialize for RemoteAddr
impl Serialize for RemoteAddr
sourceimpl ToRemoteAddr for RemoteAddr
impl ToRemoteAddr for RemoteAddr
fn to_remote_addr(&self) -> Result<RemoteAddr>
sourceimpl 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. Read more
sourcefn to_socket_addrs(&self) -> Result<Self::Iter>
fn to_socket_addrs(&self) -> Result<Self::Iter>
Converts this object to an iterator of resolved SocketAddr
s. Read more
impl Eq for RemoteAddr
impl StructuralEq for RemoteAddr
impl StructuralPartialEq for RemoteAddr
Auto Trait Implementations
impl RefUnwindSafe for RemoteAddr
impl Send for RemoteAddr
impl Sync for RemoteAddr
impl Unpin for RemoteAddr
impl UnwindSafe for RemoteAddr
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more