Struct quilkin::net::endpoint::EndpointAddress
source · pub struct EndpointAddress {
pub host: AddressKind,
pub port: u16,
}
Expand description
A valid socket address. This differs from std::net::SocketAddr
, in that it
it supports parsing Domain Names in addition to IP addresses. Domain Names
are resolved when ToSocketAddrs::to_socket_addrs
is called.
Fields§
§host: AddressKind
A valid name or IP address that resolves to a address.
port: u16
The port of the socket address, if present.
Implementations§
source§impl EndpointAddress
impl EndpointAddress
pub const UNSPECIFIED: Self = _
pub const LOCALHOST: Self = _
source§impl EndpointAddress
impl EndpointAddress
sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
Returns the port for the endpoint address, or 0
if no port
was specified.
sourcepub async fn to_socket_addr(&self) -> Result<SocketAddr>
pub async fn to_socket_addr(&self) -> Result<SocketAddr>
Returns the socket address for the endpoint, resolving any DNS entries if present.
Trait Implementations§
source§impl Clone for EndpointAddress
impl Clone for EndpointAddress
source§fn clone(&self) -> EndpointAddress
fn clone(&self) -> EndpointAddress
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 EndpointAddress
impl Debug for EndpointAddress
source§impl<'de> Deserialize<'de> for EndpointAddress
impl<'de> Deserialize<'de> for EndpointAddress
source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for EndpointAddress
impl Display for EndpointAddress
source§impl From<(AddressKind, u16)> for EndpointAddress
impl From<(AddressKind, u16)> for EndpointAddress
source§fn from((host, port): (AddressKind, u16)) -> Self
fn from((host, port): (AddressKind, u16)) -> Self
Converts to this type from the input type.
source§impl From<EndpointAddress> for Address
impl From<EndpointAddress> for Address
source§fn from(address: EndpointAddress) -> Self
fn from(address: EndpointAddress) -> Self
Converts to this type from the input type.
source§impl From<EndpointAddress> for Address
impl From<EndpointAddress> for Address
source§fn from(address: EndpointAddress) -> Self
fn from(address: EndpointAddress) -> Self
Converts to this type from the input type.
source§impl From<EndpointAddress> for SocketAddress
impl From<EndpointAddress> for SocketAddress
source§fn from(address: EndpointAddress) -> Self
fn from(address: EndpointAddress) -> Self
Converts to this type from the input type.
source§impl From<SocketAddr> for EndpointAddress
impl From<SocketAddr> for EndpointAddress
source§fn from(socket: SocketAddr) -> Self
fn from(socket: SocketAddr) -> Self
Converts to this type from the input type.
source§impl FromStr for EndpointAddress
impl FromStr for EndpointAddress
Forwards the deserialisation to use std::net::ToSocketAddrs
instead of
FromStr
for validation which allows us to resolve DNS hostnames such as
localhost
or container network names at parse-time.
source§impl Hash for EndpointAddress
impl Hash for EndpointAddress
source§impl Ord for EndpointAddress
impl Ord for EndpointAddress
source§fn cmp(&self, other: &EndpointAddress) -> Ordering
fn cmp(&self, other: &EndpointAddress) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<EndpointAddress> for Endpoint
impl PartialEq<EndpointAddress> for Endpoint
source§fn eq(&self, rhs: &EndpointAddress) -> bool
fn eq(&self, rhs: &EndpointAddress) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq for EndpointAddress
impl PartialEq for EndpointAddress
source§fn eq(&self, other: &EndpointAddress) -> bool
fn eq(&self, other: &EndpointAddress) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for EndpointAddress
impl PartialOrd for EndpointAddress
source§fn partial_cmp(&self, other: &EndpointAddress) -> Option<Ordering>
fn partial_cmp(&self, other: &EndpointAddress) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for EndpointAddress
impl Serialize for EndpointAddress
source§impl TryFrom<Address> for EndpointAddress
impl TryFrom<Address> for EndpointAddress
source§impl TryFrom<Address> for EndpointAddress
impl TryFrom<Address> for EndpointAddress
source§impl TryFrom<Endpoint> for EndpointAddress
impl TryFrom<Endpoint> for EndpointAddress
source§impl TryFrom<SocketAddress> for EndpointAddress
impl TryFrom<SocketAddress> for EndpointAddress
impl Eq for EndpointAddress
impl StructuralPartialEq for EndpointAddress
Auto Trait Implementations§
impl RefUnwindSafe for EndpointAddress
impl Send for EndpointAddress
impl Sync for EndpointAddress
impl Unpin for EndpointAddress
impl UnwindSafe for EndpointAddress
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request