pub struct UniAddr { /* private fields */ }This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
Expand description
A unified address type that can represent:
std::net::SocketAddrunix::SocketAddr(a wrapper overstd::os::unix::net::SocketAddr)- A host name with port. See
ToSocketAddrs.
§Parsing Behaviour
- Checks if the address started with
UNIX_URI_PREFIX: parse as a UDS address. - Checks if the address is started with a alphabetic character (a-z, A-Z): treat as a host name. Notes that we will not validate if the host name is valid.
- Tries to parse as a network socket address.
- Otherwise, treats the input as a host name.
Implementations§
Source§impl UniAddr
impl UniAddr
Sourcepub const fn as_inner(&self) -> &UniAddrInner
👎Deprecated since 0.0.0: This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
pub const fn as_inner(&self) -> &UniAddrInner
This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
Returns a reference to the inner value.
Source§impl UniAddr
impl UniAddr
Sourcepub fn new(addr: &str) -> Result<Self, ParseError>
👎Deprecated since 0.0.0: This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
pub fn new(addr: &str) -> Result<Self, ParseError>
This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
Sourcepub fn new_host(
addr: &str,
parsed: Option<(&str, u16)>,
) -> Result<Self, ParseError>
👎Deprecated since 0.0.0: This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
pub fn new_host( addr: &str, parsed: Option<(&str, u16)>, ) -> Result<Self, ParseError>
This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
Creates a new UniAddr from a string containing a host name and port,
like example.com:8080.
§Errors
ParseError::InvalidHostif the host name is invalid.ParseError::InvalidPortif the port is invalid.
Sourcepub fn blocking_resolve_socket_addrs(&mut self) -> Result<()>
👎Deprecated since 0.0.0: This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
pub fn blocking_resolve_socket_addrs(&mut self) -> Result<()>
This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
Resolves the address if it is a host name.
By default, we utilize the method ToSocketAddrs::to_socket_addrs
provided by the standard library to perform DNS resolution, which is a
blocking operation and may take an arbitrary amount of time to
complete, use with caution when called in asynchronous contexts.
§Errors
Resolution failure, or if no socket address resolved.
Sourcepub fn blocking_resolve_socket_addrs_with<F, A>(&mut self, f: F) -> Result<()>
👎Deprecated since 0.0.0: This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
pub fn blocking_resolve_socket_addrs_with<F, A>(&mut self, f: F) -> Result<()>
This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
Resolves the address if it is a host name using a custom resolver function.
§Errors
Resolution failure, or if no socket address resolved.
Sourcepub async fn resolve_socket_addrs(&mut self) -> Result<()>
👎Deprecated since 0.0.0: This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
pub async fn resolve_socket_addrs(&mut self) -> Result<()>
This crate is deprecated, use uaddr instead: https://crates.io/crates/uaddr
Asynchronously resolves the address if it is a host name.
This method will spawn a blocking Tokio task to perform the resolution
using ToSocketAddrs::to_socket_addrs provided by the standard
library.
§Errors
Resolution failure, or if no socket address resolved.
Methods from Deref<Target = UniAddrInner>§
Trait Implementations§
Source§impl AsRef<UniAddrInner> for UniAddr
impl AsRef<UniAddrInner> for UniAddr
Source§fn as_ref(&self) -> &UniAddrInner
fn as_ref(&self) -> &UniAddrInner
Source§impl<'de> Deserialize<'de> for UniAddr
Available on crate feature feat-serde only.
impl<'de> Deserialize<'de> for UniAddr
feat-serde only.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>,
Source§impl From<SocketAddr> for UniAddr
impl From<SocketAddr> for UniAddr
Source§fn from(addr: SocketAddr) -> Self
fn from(addr: SocketAddr) -> Self
Source§impl From<SocketAddr> for UniAddr
Available on Unix only.
impl From<SocketAddr> for UniAddr
Source§fn from(addr: SocketAddr) -> Self
fn from(addr: SocketAddr) -> Self
Source§impl From<SocketAddr> for UniAddr
Available on Unix and crate feature feat-tokio only.
impl From<SocketAddr> for UniAddr
feat-tokio only.