HostAddr

Struct HostAddr 

Source
pub struct HostAddr<S> { /* private fields */ }
Expand description

A host address, which consists of a Host and an optional port number.

Implementations§

Source§

impl<S> HostAddr<S>

Source

pub const fn new(host: Host<S>) -> HostAddr<S>

Create a new host address

§Example
use hostaddr::HostAddr;

let host = HostAddr::<String>::new("example.com".parse().unwrap());
println!("{}", host);
Source

pub fn from_domain(domain: Domain<S>) -> HostAddr<S>

Create a new host address from a domain name

§Example
use hostaddr::{HostAddr, Domain};

let host = HostAddr::<String>::from_domain("example.com".parse().unwrap());
println!("{}", host);
Source

pub const fn from_ip_addr(ip: IpAddr) -> HostAddr<S>

Create a new host address from an IP address

§Example
use hostaddr::HostAddr;

let host = HostAddr::<String>::from_ip_addr("127.0.0.1".parse().unwrap());
println!("{}", host);
Source

pub const fn from_sock_addr(addr: SocketAddr) -> HostAddr<S>

Create a new host address from a SocketAddr

§Example
use hostaddr::HostAddr;

let host = HostAddr::<String>::from_sock_addr("127.0.0.1:8080".parse().unwrap());
println!("{}", host);
Source

pub const fn host(&self) -> &Host<S>

Get the host name

§Example
use hostaddr::HostAddr;

let addr: HostAddr<String> = "example.com:8080".parse().unwrap();
println!("{}", addr.host());
Source

pub const fn ip(&self) -> Option<&IpAddr>

Get the ip address

§Example
use hostaddr::HostAddr;

let addr: HostAddr<String> = HostAddr::from_ip_addr("127.0.0.1".parse().unwrap());
println!("{}", addr.ip().unwrap());
Source

pub const fn port(&self) -> Option<u16>

Get the port number

§Example
use hostaddr::HostAddr;

let addr: HostAddr<String> = "example.com:8080".parse().unwrap();

assert_eq!(Some(8080), addr.port());
Source

pub const fn set_port(&mut self, port: u16) -> &mut HostAddr<S>

Set the port number

§Example
use hostaddr::HostAddr;

let mut host: HostAddr<String> = "example.com".parse().unwrap();
host
  .set_port(8080)
  .set_host("example.org".parse().unwrap());
assert_eq!(Some(8080), host.port());
Source

pub const fn maybe_port(&mut self, port: Option<u16>) -> &mut HostAddr<S>

Set the port number

See also maybe_with_port.

§Example
use hostaddr::HostAddr;

let mut host: HostAddr<String> = "example.com".parse().unwrap();
host
  .maybe_port(Some(8080))
  .set_host("example.org".parse().unwrap());
assert_eq!(Some(8080), host.port());
Source

pub const fn maybe_with_port(self, port: Option<u16>) -> HostAddr<S>

Set the port number

See also maybe_port.

§Example
use hostaddr::HostAddr;

let host  = "example.com".parse::<HostAddr<String>>().unwrap().maybe_with_port(Some(8080));
assert_eq!(Some(8080), host.port());
Source

pub const fn with_port(self, port: u16) -> HostAddr<S>

Set the port number

See also set_port.

§Example
use hostaddr::HostAddr;

let host = "example.com".parse::<HostAddr<String>>().unwrap().with_port(8080);
assert_eq!(Some(8080), host.port());
Source

pub const fn with_default_port(self, default: u16) -> HostAddr<S>

Set a default port if no port is currently set.

If a port is already set, this method does nothing.

§Example
use hostaddr::HostAddr;

let addr = "example.com".parse::<HostAddr<String>>().unwrap()
  .with_default_port(443);
assert_eq!(Some(443), addr.port());

let addr = "example.com:8080".parse::<HostAddr<String>>().unwrap()
  .with_default_port(443);
assert_eq!(Some(8080), addr.port());
Source

pub const fn clear_port(&mut self) -> &mut HostAddr<S>

Clear the port number.

§Example
use hostaddr::HostAddr;

let mut addr: HostAddr<String> = "example.com:8080".parse().unwrap();
addr.clear_port();
assert_eq!(None, addr.port());
Source

pub const fn has_port(&self) -> bool

Returns true if a port is set.

§Example
use hostaddr::HostAddr;

let addr: HostAddr<String> = "example.com:8080".parse().unwrap();
assert!(addr.has_port());

let addr: HostAddr<String> = "example.com".parse().unwrap();
assert!(!addr.has_port());
Source

pub fn set_host(&mut self, host: Host<S>) -> &mut HostAddr<S>

Set the host name

§Example
use hostaddr::HostAddr;

let mut addr: HostAddr<String> = "example.com".parse().unwrap();
addr
  .set_host("example.org".parse().unwrap())
  .set_port(8080);
assert_eq!("example.org", addr.as_ref().host().unwrap_domain().as_str());
Source

pub fn with_host(self, host: Host<S>) -> HostAddr<S>

Set the host name

§Example
use hostaddr::HostAddr;

let addr: HostAddr<String> = HostAddr::from_sock_addr("127.0.0.1:8080".parse().unwrap())
  .with_host("example.com".parse().unwrap());
assert_eq!("example.com", addr.as_ref().host().unwrap_domain().as_str());
Source

pub const fn is_ip(&self) -> bool

Returns true if the host is an IP address

§Example
use hostaddr::HostAddr;

let host: HostAddr<String> = HostAddr::from_sock_addr("127.0.0.1:8080".parse().unwrap());
assert!(host.is_ip());
Source

pub const fn is_ipv4(&self) -> bool

Returns true if the host is an Ipv4 address

§Example
use hostaddr::HostAddr;

let host: HostAddr<String> = HostAddr::from_sock_addr("127.0.0.1:8080".parse().unwrap());
assert!(host.is_ipv4());
Source

pub const fn is_ipv6(&self) -> bool

Returns true if the host is an Ipv6 address

§Example
use hostaddr::HostAddr;

let host: HostAddr<String> = HostAddr::from_sock_addr("[::1]:8080".parse().unwrap());
assert!(host.is_ipv6());
Source

pub const fn is_domain(&self) -> bool

Returns true if the host is a domain name

§Example
use hostaddr::HostAddr;

let host: HostAddr<String> = "example.com".parse().unwrap();
assert!(host.is_domain());
Source

pub fn is_localhost(&self) -> bool
where S: AsRef<str>,

Returns true if the host represents localhost.

This method checks if the host is:

  • An IPv4 loopback address (127.0.0.0/8)
  • An IPv6 loopback address (::1)
  • The domain name “localhost”
§Example
use hostaddr::HostAddr;

let addr = HostAddr::try_from_ascii_str("127.0.0.1").unwrap();
assert!(addr.is_localhost());

let addr = HostAddr::try_from_ascii_str("::1").unwrap();
assert!(addr.is_localhost());

let addr = HostAddr::try_from_ascii_str("localhost").unwrap();
assert!(addr.is_localhost());

let addr = HostAddr::try_from_ascii_str("example.com").unwrap();
assert!(!addr.is_localhost());
Source

pub const fn to_socket_addr(&self) -> Option<SocketAddr>

Converts to a SocketAddr if the host is an IP address and a port is set.

Returns None if the host is a domain name or if no port is set.

§Example
use hostaddr::HostAddr;
use std::net::{IpAddr, SocketAddr};

let addr: HostAddr<String> = "127.0.0.1:8080".parse().unwrap();
assert_eq!(
  Some(SocketAddr::new("127.0.0.1".parse::<IpAddr>().unwrap(), 8080)),
  addr.to_socket_addr()
);

// Domain names cannot be converted to SocketAddr
let addr: HostAddr<String> = "example.com:8080".parse().unwrap();
assert_eq!(None, addr.to_socket_addr());

// Missing port returns None
let addr: HostAddr<String> = "127.0.0.1".parse().unwrap();
assert_eq!(None, addr.to_socket_addr());
Source

pub const fn as_ref(&self) -> HostAddr<&S>

Converts from &HostAddr<S> to HostAddr<&S>.

§Example
use std::sync::Arc;
use hostaddr::HostAddr;

let host: HostAddr<Arc<str>> = "example.com:8080".try_into().unwrap();
assert_eq!("example.com", &**host.as_ref().host().unwrap_domain());
Source

pub fn as_deref(&self) -> HostAddr<&<S as Deref>::Target>
where S: Deref,

Converts from HostAddr<S> (or &HostAddr<S>) to HostAddr<&S::Target>.

§Example
use std::sync::Arc;
use hostaddr::HostAddr;

let host = "example.com:9090".parse::<HostAddr<Arc<str>>>().unwrap();
assert_eq!("example.com", host.as_deref().host().unwrap_domain());
Source

pub fn into_components(self) -> (Host<S>, Option<u16>)

Consumes the HostAddr and returns the host name and port number.

§Example
use hostaddr::HostAddr;

let host: HostAddr<String> = "example.com:8080".parse().unwrap();
let (host, port) = host.into_components();
assert_eq!("example.com", host.unwrap_domain().as_str());
assert_eq!(Some(8080), port);
Source

pub fn unwrap_domain(self) -> (S, Option<u16>)

Unwraps the domain, panics if the host is an IP address.

§Example
use hostaddr::HostAddr;

let host: HostAddr<String> = "example.com".parse().unwrap();
let (domain, port) = host.unwrap_domain();
assert_eq!("example.com", domain.as_str());
assert_eq!(None, port);
Source

pub fn unwrap_ip(self) -> (IpAddr, Option<u16>)

Unwraps the IP address, panics if the host is a domain name.

§Example
use hostaddr::HostAddr;

let host: HostAddr<String> = HostAddr::from_sock_addr("[::1]:8080".parse().unwrap());
let (ip, port) = host.unwrap_ip();
assert_eq!(ip, "::1".parse::<std::net::IpAddr>().unwrap());
assert_eq!(Some(8080), port);
Source§

impl<S> HostAddr<&S>

Source

pub const fn copied(self) -> HostAddr<S>
where S: Copy,

Maps an HostAddr<&S> to an HostAddr<S> by copying the contents of the host addr.

§Example
use hostaddr::{HostAddr, Buffer};

let host: HostAddr<Buffer> = HostAddr::try_from("example.com").unwrap();
assert_eq!("example.com", host.as_ref().copied().unwrap_domain().0.as_str());
Source

pub fn cloned(self) -> HostAddr<S>
where S: Clone,

Maps an HostAddr<&S> to an HostAddr<S> by cloning the contents of the host addr.

§Example
use hostaddr::HostAddr;

let host: HostAddr<String> = "example.com".parse().unwrap();
assert_eq!("example.com", host.as_ref().cloned().unwrap_domain().0.as_str());
Source§

impl<'a> HostAddr<&'a str>

Source

pub fn try_from_ascii_str( input: &'a str, ) -> Result<HostAddr<&'a str>, ParseAsciiHostAddrError>

Parses a HostAddr name from &str.

Unlike HostAddr::try_from or HostAddr::from_str, this method does not perform any percent decoding or punycode decoding. If the input is not ASCII, it will return an error.

§Example
use hostaddr::HostAddr;

let host = HostAddr::try_from_ascii_str("example.com").unwrap();
assert_eq!(host.unwrap_domain().0, "example.com");

// This will return an error because the domain is not ASCII.
assert!(HostAddr::try_from_ascii_str("测试.中国").is_err());

// Thie will not return an error, even though the human-readable domain is not ASCII.
let host = HostAddr::try_from_ascii_str("xn--0zwm56d.xn--fiqs8s").unwrap();
assert_eq!(host.unwrap_domain().0, "xn--0zwm56d.xn--fiqs8s");
Source

pub const fn as_bytes(&self) -> HostAddr<&'a [u8]>

Converts the domain to a HostAddr<&'a [u8]>.

§Example
use hostaddr::HostAddr;

let addr = HostAddr::try_from_ascii_str("example.com").unwrap();
assert_eq!(addr.as_bytes().unwrap_domain().0, b"example.com");
Source§

impl<'a> HostAddr<&'a [u8]>

Source

pub fn try_from_ascii_bytes( input: &'a [u8], ) -> Result<HostAddr<&'a [u8]>, ParseAsciiHostAddrError>

Parses a HostAddr from &[u8].

Unlike HostAddr::try_from or HostAddr::from_str, this method does not perform any percent decoding or punycode decoding. If the input is not ASCII, it will return an error.

§Example
use hostaddr::HostAddr;

let host = HostAddr::try_from_ascii_bytes(b"example.com").unwrap();
assert_eq!(host.unwrap_domain().0, b"example.com");

// This will return an error because the domain is not ASCII.
assert!(HostAddr::try_from_ascii_bytes("测试.中国".as_bytes()).is_err());

// Thie will not return an error, even though the human-readable domain is not ASCII.
let host = HostAddr::try_from_ascii_bytes(b"xn--0zwm56d.xn--fiqs8s").unwrap();
assert_eq!(host.unwrap_domain().0, b"xn--0zwm56d.xn--fiqs8s");
Source

pub const fn as_str(&self) -> HostAddr<&'a str>

Converts the domain to a HostAddr<&'a str>.

§Example
use hostaddr::HostAddr;

let addr = HostAddr::try_from_ascii_bytes(b"example.com").unwrap();
assert_eq!(addr.as_str().unwrap_domain().0, "example.com");

Trait Implementations§

Source§

impl<S> CheapClone for HostAddr<S>
where S: CheapClone,

Source§

fn cheap_clone(&self) -> Self

Returns a copy of the value.
Source§

impl<S> Clone for HostAddr<S>
where S: Clone,

Source§

fn clone(&self) -> HostAddr<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Data for HostAddr<SmolStr>

Source§

type Ref<'a> = HostAddr<Buffer>

The reference type of the data.
Source§

fn from_ref( val: <HostAddr<SmolStr> as Data>::Ref<'_>, ) -> Result<HostAddr<SmolStr>, DecodeError>

Converts the reference type to the owned type.
Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the data only considering the data itself, (e.g. no length prefix, no wire type).
Source§

fn encode(&self, buf: &mut [u8]) -> Result<usize, EncodeError>

Encodes the message to a buffer. Read more
Source§

const WIRE_TYPE: WireType = WireType::LengthDelimited

The wire type of the data.
Source§

fn encoded_len_with_length_delimited(&self) -> usize

Returns the encoded length of the data including the length delimited.
Source§

fn encode_to_vec(&self) -> Result<Vec<u8>, EncodeError>

Encodes the message into a vec.
Source§

fn encode_to_bytes(&self) -> Result<Bytes, EncodeError>

Encodes the message into a Bytes.
Source§

fn encode_length_delimited(&self, buf: &mut [u8]) -> Result<usize, EncodeError>

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Result<Vec<u8>, EncodeError>

Encodes the message with a length-delimiter into a vec.
Source§

fn encode_length_delimited_to_bytes(&self) -> Result<Bytes, EncodeError>

Encodes the message with a length-delimiter into a Bytes.
Source§

fn decode(src: &[u8]) -> Result<(usize, Self), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: &[u8]) -> Result<(usize, Self), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from the buffer.
Source§

impl<'a> DataRef<'a, HostAddr<SmolStr>> for HostAddr<Buffer>

Source§

fn decode(buf: &'a [u8]) -> Result<(usize, HostAddr<Buffer>), 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,

Decodes a length-delimited reference instance of the message from the buffer.
Source§

impl<S> Debug for HostAddr<S>
where S: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<S> Display for HostAddr<S>
where S: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, S> From<&'a HostAddr<S>> for HostAddr<&'a Domain<S>>

Source§

fn from(value: &'a HostAddr<S>) -> HostAddr<&'a Domain<S>>

use hostaddr::{HostAddr, Domain};
use std::net::Ipv6Addr;

let ip = "::1".parse::<Ipv6Addr>().unwrap();
let addr = HostAddr::<String>::from(ip);

let domain_addr: HostAddr<&Domain<String>> = (&addr).into();
Source§

impl<S> From<(Domain<S>, u16)> for HostAddr<S>

Source§

fn from(_: (Domain<S>, u16)) -> HostAddr<S>

use hostaddr::{Domain, HostAddr};

let domain = Domain::<String>::try_from("example.com").unwrap();
let host = HostAddr::<String>::from((domain, 8080));
Source§

impl<S> From<(IpAddr, u16)> for HostAddr<S>

Source§

fn from(_: (IpAddr, u16)) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::IpAddr;

let ip = "127.0.0.1".parse::<IpAddr>().unwrap();
let addr = HostAddr::<String>::from((ip, 8080));
Source§

impl<S> From<(Ipv4Addr, u16)> for HostAddr<S>

Source§

fn from(_: (Ipv4Addr, u16)) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::Ipv4Addr;

let ip = "127.0.0.1".parse::<Ipv4Addr>().unwrap();
let addr = HostAddr::<String>::from((ip, 8080));
Source§

impl<S> From<(Ipv6Addr, u16)> for HostAddr<S>

Source§

fn from(_: (Ipv6Addr, u16)) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::Ipv6Addr;

let ip = "::1".parse::<Ipv6Addr>().unwrap();
let addr = HostAddr::<String>::from((ip, 8080));
Source§

impl<S> From<(u16, Domain<S>)> for HostAddr<S>

Source§

fn from(_: (u16, Domain<S>)) -> HostAddr<S>

use hostaddr::{Domain, HostAddr};

let domain = Domain::<String>::try_from("example.com").unwrap();
let host = HostAddr::<String>::from((8080, domain));
Source§

impl<S> From<(u16, IpAddr)> for HostAddr<S>

Source§

fn from(_: (u16, IpAddr)) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::IpAddr;

let ip = "::1".parse::<IpAddr>().unwrap();
let addr = HostAddr::<String>::from((8080, ip));
Source§

impl<S> From<Domain<S>> for HostAddr<S>

Source§

fn from(domain: Domain<S>) -> HostAddr<S>

use hostaddr::{Domain, HostAddr};

let domain = Domain::<String>::try_from("example.com").unwrap();
let host = HostAddr::<String>::from(domain);
Source§

impl<S> From<HostAddr<S>> for HostAddr<Domain<S>>

Source§

fn from(value: HostAddr<S>) -> HostAddr<Domain<S>>

use hostaddr::{HostAddr, Domain};
use std::net::Ipv6Addr;

let ip = "::1".parse::<Ipv6Addr>().unwrap();
let addr = HostAddr::<String>::from(ip);
let domain_addr: HostAddr<Domain<String>> = addr.into();
Source§

impl<S> From<IpAddr> for HostAddr<S>

Source§

fn from(ip: IpAddr) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::IpAddr;

let ip = "127.0.0.1".parse::<IpAddr>().unwrap();
let addr = HostAddr::<String>::from(ip);
Source§

impl<S> From<Ipv4Addr> for HostAddr<S>

Source§

fn from(ip: Ipv4Addr) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::Ipv4Addr;

let ip = "127.0.0.1".parse::<Ipv4Addr>().unwrap();
let addr = HostAddr::<String>::from(ip);
Source§

impl<S> From<Ipv6Addr> for HostAddr<S>

Source§

fn from(ip: Ipv6Addr) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::Ipv6Addr;

let ip = "::1".parse::<Ipv6Addr>().unwrap();
let addr = HostAddr::<String>::from(ip);
Source§

impl<S> From<SocketAddr> for HostAddr<S>

Source§

fn from(addr: SocketAddr) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::SocketAddr;

let addr = "127.0.0.1:8080".parse::<SocketAddr>().unwrap();
let host = HostAddr::<String>::from(addr);
Source§

impl<S> From<SocketAddrV4> for HostAddr<S>

Source§

fn from(addr: SocketAddrV4) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::SocketAddrV4;

let addr = "127.0.0.1:8080".parse::<SocketAddrV4>().unwrap();
let host = HostAddr::<String>::from(addr);
Source§

impl<S> From<SocketAddrV6> for HostAddr<S>

Source§

fn from(addr: SocketAddrV6) -> HostAddr<S>

use hostaddr::HostAddr;
use std::net::SocketAddrV6;

let addr = "[::1]:8080".parse::<SocketAddrV6>().unwrap();
let host = HostAddr::<String>::from(addr);
Source§

impl<S> FromStr for HostAddr<S>
where Domain<S>: FromStr,

Source§

type Err = ParseHostAddrError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<HostAddr<S>, <HostAddr<S> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<S> Hash for HostAddr<S>
where S: Hash,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<S> Ord for HostAddr<S>
where S: Ord,

Source§

fn cmp(&self, other: &HostAddr<S>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<S> PartialEq for HostAddr<S>
where S: PartialEq,

Source§

fn eq(&self, other: &HostAddr<S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S> PartialOrd for HostAddr<S>
where S: PartialOrd,

Source§

fn partial_cmp(&self, other: &HostAddr<S>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, S> TryFrom<&'a str> for HostAddr<S>
where Domain<S>: TryFrom<&'a str>,

Source§

type Error = ParseHostAddrError

The type returned in the event of a conversion error.
Source§

fn try_from( s: &'a str, ) -> Result<HostAddr<S>, <HostAddr<S> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a, S> TryFrom<(&'a str, u16)> for HostAddr<S>
where Domain<S>: TryFrom<&'a str>,

Source§

type Error = ParseHostAddrError

The type returned in the event of a conversion error.
Source§

fn try_from( _: (&'a str, u16), ) -> Result<HostAddr<S>, <HostAddr<S> as TryFrom<(&'a str, u16)>>::Error>

Performs the conversion.
Source§

impl<S> Copy for HostAddr<S>
where S: Copy,

Source§

impl<S> Eq for HostAddr<S>
where S: Eq,

Source§

impl<S> StructuralPartialEq for HostAddr<S>

Auto Trait Implementations§

§

impl<S> Freeze for HostAddr<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for HostAddr<S>
where S: RefUnwindSafe,

§

impl<S> Send for HostAddr<S>
where S: Send,

§

impl<S> Sync for HostAddr<S>
where S: Sync,

§

impl<S> Unpin for HostAddr<S>
where S: Unpin,

§

impl<S> UnwindSafe for HostAddr<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Address for T
where T: CheapClone + Eq + Ord + Hash + Debug + Display + Unpin + 'static,

Source§

impl<T> Id for T
where T: CheapClone + Eq + Ord + Hash + Debug + Display + Unpin + 'static,