pub struct NetworkAddr { /* private fields */ }
Implementations§
Source§impl NetworkAddr
impl NetworkAddr
pub const LOCALHOST: &'static str = "0.0.0.0"
pub fn new(host: impl ToString, port: u16) -> NetworkAddr
Sourcepub fn try_from_url(url: Url) -> Result<NetworkAddr, ConfigError>
pub fn try_from_url(url: Url) -> Result<NetworkAddr, ConfigError>
tries returning a new instance from the given url
pub fn parse_url(url: &str) -> Result<NetworkAddr, ConfigError>
Sourcepub fn localhost(port: u16) -> NetworkAddr
pub fn localhost(port: u16) -> NetworkAddr
returns a new instance with the given port and the localhost address
Sourcepub fn from_socket_addr(addr: SocketAddr) -> NetworkAddr
pub fn from_socket_addr(addr: SocketAddr) -> NetworkAddr
returns a new NetworkAddr
instance from the given SocketAddr
Sourcepub fn as_socket_addr(&self) -> SocketAddr
pub fn as_socket_addr(&self) -> SocketAddr
parse the address into a SocketAddr
Sourcepub fn set_port(&mut self, port: u16) -> &mut NetworkAddr
pub fn set_port(&mut self, port: u16) -> &mut NetworkAddr
updates the port before returning a mutable reference to the address
Sourcepub fn with_port(self, port: u16) -> NetworkAddr
pub fn with_port(self, port: u16) -> NetworkAddr
consumes the current instance to create another with the given port
Sourcepub fn set_host<T>(&mut self, host: T) -> &mut NetworkAddrwhere
T: ToString,
pub fn set_host<T>(&mut self, host: T) -> &mut NetworkAddrwhere
T: ToString,
updates the host before returning a mutable reference to the address
Sourcepub fn with_host<T>(self, host: T) -> NetworkAddrwhere
T: ToString,
pub fn with_host<T>(self, host: T) -> NetworkAddrwhere
T: ToString,
consumes the current instance to create another with the given host
Trait Implementations§
Source§impl Clone for NetworkAddr
impl Clone for NetworkAddr
Source§fn clone(&self) -> NetworkAddr
fn clone(&self) -> NetworkAddr
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 NetworkAddr
impl Debug for NetworkAddr
Source§impl Default for NetworkAddr
impl Default for NetworkAddr
Source§fn default() -> NetworkAddr
fn default() -> NetworkAddr
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for NetworkAddrwhere
NetworkAddr: Default,
impl<'de> Deserialize<'de> for NetworkAddrwhere
NetworkAddr: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NetworkAddr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NetworkAddr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for NetworkAddr
impl Display for NetworkAddr
Source§impl From<SocketAddr> for NetworkAddr
impl From<SocketAddr> for NetworkAddr
Source§fn from(addr: SocketAddr) -> NetworkAddr
fn from(addr: SocketAddr) -> NetworkAddr
Converts to this type from the input type.
Source§impl FromStr for NetworkAddr
impl FromStr for NetworkAddr
Source§type Err = ConfigError
type Err = ConfigError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<NetworkAddr, <NetworkAddr as FromStr>::Err>
fn from_str(s: &str) -> Result<NetworkAddr, <NetworkAddr as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moreSource§impl Hash for NetworkAddr
impl Hash for NetworkAddr
Source§impl Ord for NetworkAddr
impl Ord for NetworkAddr
Source§fn cmp(&self, other: &NetworkAddr) -> Ordering
fn cmp(&self, other: &NetworkAddr) -> 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 for NetworkAddr
impl PartialEq for NetworkAddr
Source§impl PartialOrd for NetworkAddr
impl PartialOrd for NetworkAddr
Source§impl Serialize for NetworkAddr
impl Serialize for NetworkAddr
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 TryFrom<Url> for NetworkAddr
impl TryFrom<Url> for NetworkAddr
Source§type Error = ConfigError
type Error = ConfigError
The type returned in the event of a conversion error.
Source§fn try_from(
url: Url,
) -> Result<NetworkAddr, <NetworkAddr as TryFrom<Url>>::Error>
fn try_from( url: Url, ) -> Result<NetworkAddr, <NetworkAddr as TryFrom<Url>>::Error>
Performs the conversion.
impl Eq for NetworkAddr
impl StructuralPartialEq for NetworkAddr
Auto Trait Implementations§
impl Freeze for NetworkAddr
impl RefUnwindSafe for NetworkAddr
impl Send for NetworkAddr
impl Sync for NetworkAddr
impl Unpin for NetworkAddr
impl UnwindSafe for NetworkAddr
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<T> Displayable for T
impl<T> Displayable for T
fn __private__(&self) -> Seal
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§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.