pub struct HostAddrRef<'a> { /* private fields */ }
Expand description
A host address which supports both domain:port
and socket address.
e.g. Valid format
www.example.com:8080
[::1]:8080
127.0.0.1:8080
Implementations§
Source§impl<'a> HostAddrRef<'a>
impl<'a> HostAddrRef<'a>
Sourcepub fn from_domain(
s: &'a str,
port: u16,
) -> Result<HostAddrRef<'a>, ParseHostAddrError>
pub fn from_domain( s: &'a str, port: u16, ) -> Result<HostAddrRef<'a>, ParseHostAddrError>
Create a new address from domain and port
Sourcepub fn domain(&self) -> Option<&DomainRef<'a>>
pub fn domain(&self) -> Option<&DomainRef<'a>>
Returns the domain of the address if this address can only be represented by domain name
Sourcepub const fn ip(&self) -> Option<IpAddr>
pub const fn ip(&self) -> Option<IpAddr>
Returns the ip of the address if this address can be represented by IpAddr
Sourcepub fn into_inner(self) -> Either<SocketAddr, (u16, DomainRef<'a>)> ⓘ
pub fn into_inner(self) -> Either<SocketAddr, (u16, DomainRef<'a>)> ⓘ
Consumes the host addr and returns the inner data
Trait Implementations§
Source§impl<'a> Clone for HostAddrRef<'a>
impl<'a> Clone for HostAddrRef<'a>
Source§fn clone(&self) -> HostAddrRef<'a>
fn clone(&self) -> HostAddrRef<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> DataRef<'a, HostAddr> for HostAddrRef<'a>
impl<'a> DataRef<'a, HostAddr> for HostAddrRef<'a>
Source§fn decode(buf: &'a [u8]) -> Result<(usize, HostAddrRef<'a>), DecodeError>
fn decode(buf: &'a [u8]) -> Result<(usize, HostAddrRef<'a>), DecodeError>
Decodes the reference type from a buffer. Read more
Source§fn decode_length_delimited(src: &'a [u8]) -> Result<(usize, Self), DecodeError>where
Self: Sized,
fn decode_length_delimited(src: &'a [u8]) -> Result<(usize, Self), DecodeError>where
Self: Sized,
Decodes a length-delimited reference instance of the message from the buffer.
Source§impl<'a> Debug for HostAddrRef<'a>
impl<'a> Debug for HostAddrRef<'a>
Source§impl<'de> Deserialize<'de> for HostAddrRef<'de>
impl<'de> Deserialize<'de> for HostAddrRef<'de>
Source§fn deserialize<D>(
deserializer: D,
) -> Result<HostAddrRef<'de>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<HostAddrRef<'de>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for HostAddrRef<'_>
impl Display for HostAddrRef<'_>
Source§impl From<SocketAddr> for HostAddrRef<'_>
impl From<SocketAddr> for HostAddrRef<'_>
Source§fn from(addr: SocketAddr) -> HostAddrRef<'_>
fn from(addr: SocketAddr) -> HostAddrRef<'_>
Converts to this type from the input type.
Source§impl<'a> Hash for HostAddrRef<'a>
impl<'a> Hash for HostAddrRef<'a>
Source§impl Ord for HostAddrRef<'_>
impl Ord for HostAddrRef<'_>
Source§fn cmp(&self, other: &HostAddrRef<'_>) -> Ordering
fn cmp(&self, other: &HostAddrRef<'_>) -> 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<'a> PartialEq for HostAddrRef<'a>
impl<'a> PartialEq for HostAddrRef<'a>
Source§impl PartialOrd for HostAddrRef<'_>
impl PartialOrd for HostAddrRef<'_>
Source§impl Serialize for HostAddrRef<'_>
impl Serialize for HostAddrRef<'_>
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl<'a> TryFrom<&'a str> for HostAddrRef<'a>
impl<'a> TryFrom<&'a str> for HostAddrRef<'a>
Source§type Error = ParseHostAddrError
type Error = ParseHostAddrError
The type returned in the event of a conversion error.
Source§fn try_from(
s: &'a str,
) -> Result<HostAddrRef<'a>, <HostAddrRef<'a> as TryFrom<&'a str>>::Error>
fn try_from( s: &'a str, ) -> Result<HostAddrRef<'a>, <HostAddrRef<'a> as TryFrom<&'a str>>::Error>
Performs the conversion.
impl<'a> Copy for HostAddrRef<'a>
impl<'a> Eq for HostAddrRef<'a>
impl<'a> StructuralPartialEq for HostAddrRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for HostAddrRef<'a>
impl<'a> RefUnwindSafe for HostAddrRef<'a>
impl<'a> Send for HostAddrRef<'a>
impl<'a> Sync for HostAddrRef<'a>
impl<'a> Unpin for HostAddrRef<'a>
impl<'a> UnwindSafe for HostAddrRef<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.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 more