pub struct NodeAddress { /* private fields */ }
Expand description
A node 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 NodeAddress
impl NodeAddress
Sourcepub fn domain(&self) -> Option<&str>
pub fn domain(&self) -> Option<&str>
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 set_port(&mut self, port: u16) -> &mut NodeAddress
pub fn set_port(&mut self, port: u16) -> &mut NodeAddress
Set the port
Sourcepub const fn with_port(self, port: u16) -> NodeAddress
pub const fn with_port(self, port: u16) -> NodeAddress
Set the port in builder pattern
Trait Implementations§
Source§impl Archive for NodeAddress
impl Archive for NodeAddress
Source§const COPY_OPTIMIZATION: CopyOptimization<NodeAddress>
const COPY_OPTIMIZATION: CopyOptimization<NodeAddress>
An optimization flag that allows the bytes of this type to be copied
directly to a writer instead of calling
serialize
. Read moreSource§impl CheapClone for NodeAddress
impl CheapClone for NodeAddress
Source§fn cheap_clone(&self) -> Self
fn cheap_clone(&self) -> Self
Returns a copy of the value.
Source§impl Clone for NodeAddress
impl Clone for NodeAddress
Source§fn clone(&self) -> NodeAddress
fn clone(&self) -> NodeAddress
Returns a duplicate 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 NodeAddress
impl Debug for NodeAddress
Source§impl<'de> Deserialize<'de> for NodeAddress
impl<'de> Deserialize<'de> for NodeAddress
Source§fn deserialize<D>(
deserializer: D,
) -> Result<NodeAddress, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NodeAddress, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<__D> Deserialize<NodeAddress, __D> for <NodeAddress as Archive>::Archived
impl<__D> Deserialize<NodeAddress, __D> for <NodeAddress as Archive>::Archived
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<NodeAddress, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<NodeAddress, <__D as Fallible>::Error>
Deserializes using the given deserializer
Source§impl Display for NodeAddress
impl Display for NodeAddress
Source§impl From<SocketAddr> for NodeAddress
impl From<SocketAddr> for NodeAddress
Source§fn from(addr: SocketAddr) -> NodeAddress
fn from(addr: SocketAddr) -> NodeAddress
Converts to this type from the input type.
Source§impl FromStr for NodeAddress
impl FromStr for NodeAddress
Source§type Err = ParseNodeAddressError
type Err = ParseNodeAddressError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<NodeAddress, <NodeAddress as FromStr>::Err>
fn from_str(s: &str) -> Result<NodeAddress, <NodeAddress as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moreSource§impl Hash for NodeAddress
impl Hash for NodeAddress
Source§impl Ord for NodeAddress
impl Ord for NodeAddress
Source§fn cmp(&self, other: &NodeAddress) -> Ordering
fn cmp(&self, other: &NodeAddress) -> 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<ArchivedNodeAddress> for NodeAddress
impl PartialEq<ArchivedNodeAddress> for NodeAddress
Source§impl PartialEq for NodeAddress
impl PartialEq for NodeAddress
Source§impl PartialOrd for NodeAddress
impl PartialOrd for NodeAddress
Source§impl<__S> Serialize<__S> for NodeAddress
impl<__S> Serialize<__S> for NodeAddress
Source§impl Serialize for NodeAddress
impl Serialize for NodeAddress
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 Transformable for NodeAddress
impl Transformable for NodeAddress
Source§type Error = NodeAddressError
type Error = NodeAddressError
The error type returned when encoding or decoding fails.
Source§fn encode(
&self,
dst: &mut [u8],
) -> Result<usize, <NodeAddress as Transformable>::Error>
fn encode( &self, dst: &mut [u8], ) -> Result<usize, <NodeAddress as Transformable>::Error>
Encodes the value into the given buffer for transmission. Read more
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Encodes the value into the given writer for transmission.
Source§async fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> Result<usize, Error>
async fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> Result<usize, Error>
Encodes the value into the given async writer for transmission.
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the value.
This is used to pre-allocate a buffer for encoding.
Source§fn decode(
src: &[u8],
) -> Result<(usize, NodeAddress), <NodeAddress as Transformable>::Error>where
NodeAddress: Sized,
fn decode(
src: &[u8],
) -> Result<(usize, NodeAddress), <NodeAddress as Transformable>::Error>where
NodeAddress: Sized,
Decodes the value from the given buffer received over the wire. Read more
Source§fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, NodeAddress), Error>
fn decode_from_reader<R>(reader: &mut R) -> Result<(usize, NodeAddress), Error>
Decodes the value from the given reader received over the wire. Read more
Source§async fn decode_from_async_reader<R>(
reader: &mut R,
) -> Result<(usize, NodeAddress), Error>
async fn decode_from_async_reader<R>( reader: &mut R, ) -> Result<(usize, NodeAddress), Error>
Decodes the value from the given async reader received over the wire. Read more
Source§impl TryFrom<&str> for NodeAddress
impl TryFrom<&str> for NodeAddress
Source§type Error = ParseNodeAddressError
type Error = ParseNodeAddressError
The type returned in the event of a conversion error.
Source§fn try_from(
value: &str,
) -> Result<NodeAddress, <NodeAddress as TryFrom<&str>>::Error>
fn try_from( value: &str, ) -> Result<NodeAddress, <NodeAddress as TryFrom<&str>>::Error>
Performs the conversion.
Source§impl TryFrom<String> for NodeAddress
impl TryFrom<String> for NodeAddress
Source§type Error = ParseNodeAddressError
type Error = ParseNodeAddressError
The type returned in the event of a conversion error.
Source§fn try_from(
s: String,
) -> Result<NodeAddress, <NodeAddress as TryFrom<String>>::Error>
fn try_from( s: String, ) -> Result<NodeAddress, <NodeAddress as TryFrom<String>>::Error>
Performs the conversion.
impl Address for NodeAddress
impl Eq for NodeAddress
impl StructuralPartialEq for NodeAddress
Auto Trait Implementations§
impl Freeze for NodeAddress
impl RefUnwindSafe for NodeAddress
impl Send for NodeAddress
impl Sync for NodeAddress
impl Unpin for NodeAddress
impl UnwindSafe for NodeAddress
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
The archived counterpart of this type. Unlike
Archive
, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
Creates the archived version of the metadata for this value.
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<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<T> Decodable for Twhere
T: Transformable,
impl<T> Decodable for Twhere
T: Transformable,
Source§type Error = <T as Transformable>::Error
type Error = <T as Transformable>::Error
The error type returned when encoding or decoding fails.
Source§fn decode(src: &[u8]) -> Result<(usize, T), <T as Decodable>::Error>
fn decode(src: &[u8]) -> Result<(usize, T), <T as Decodable>::Error>
Decodes the value from the given buffer received over the wire. Read more
Source§impl<T> Encodable for Twhere
T: Transformable,
impl<T> Encodable for Twhere
T: Transformable,
Source§type Error = <T as Transformable>::Error
type Error = <T as Transformable>::Error
The error type returned when encoding or decoding fails.
Source§fn encode(&self, dst: &mut [u8]) -> Result<usize, <T as Encodable>::Error>
fn encode(&self, dst: &mut [u8]) -> Result<usize, <T as Encodable>::Error>
Encodes the value into the given buffer for transmission. Read more
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the value.
This is used to pre-allocate a buffer for encoding.
Source§fn encode_to_vec(&self) -> Result<Vec<u8>, <T as Encodable>::Error>
fn encode_to_vec(&self) -> Result<Vec<u8>, <T as Encodable>::Error>
Encodes the value into a vec for transmission.
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<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
Compare self to
key
and return true
if they are equal.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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out
indicating that a T
is niched.