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) -> Self
Sourcepub fn try_from_url(url: Url) -> Result<Self, ConfigError>
pub fn try_from_url(url: Url) -> Result<Self, ConfigError>
tries returning a new instance from the given url
pub fn parse_url(url: &str) -> Result<Self, ConfigError>
Sourcepub fn localhost(port: u16) -> Self
pub fn localhost(port: u16) -> Self
returns a new instance with the given port and the localhost address
Sourcepub fn from_socket_addr(addr: SocketAddr) -> Self
pub fn from_socket_addr(addr: SocketAddr) -> Self
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 Self
pub fn set_port(&mut self, port: u16) -> &mut Self
updates the port before returning a mutable reference to the address
Sourcepub fn with_port(self, port: u16) -> Self
pub fn with_port(self, port: u16) -> Self
consumes the current instance to create another with the given port
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§impl<'de> Deserialize<'de> for NetworkAddrwhere
NetworkAddr: Default,
impl<'de> Deserialize<'de> for NetworkAddrwhere
NetworkAddr: Default,
Source§fn 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
Source§impl Display for NetworkAddr
impl Display for NetworkAddr
Source§impl From<NetworkAddr> for SocketAddr
impl From<NetworkAddr> for SocketAddr
Source§fn from(addr: NetworkAddr) -> Self
fn from(addr: NetworkAddr) -> Self
Converts to this type from the input type.
Source§impl From<SocketAddr> for NetworkAddr
impl From<SocketAddr> for NetworkAddr
Source§fn from(addr: SocketAddr) -> Self
fn from(addr: SocketAddr) -> Self
Converts to this type from the input type.
Source§impl FromStr for NetworkAddr
impl FromStr for NetworkAddr
Source§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§impl TryFrom<Url> for NetworkAddr
impl TryFrom<Url> for NetworkAddr
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<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.