Domain

Struct Domain 

Source
pub struct Domain<S>(/* private fields */)
where
    S: ?Sized;
Expand description

A DNS domain name, as . dot-separated labels. Non-ASCII labels are encoded in punycode per IDNA if this is the host of a special URL, or percent encoded for non-special URLs.

§Note

In this implementation, a fully-qualified domain name (FQDN) is valid. This means that the domain name can end with a . dot.

e.g.

  • example.com. is a valid domain name, because it is a FQDN.
  • A single . dot is a valid domain name, because it is root domain.

§Example

use std::{sync::Arc, str::FromStr};

use hostaddr::Domain;

let domain = Domain::<String>::from_str("example.com").unwrap();
assert_eq!(domain.as_inner(), "example.com");

let domain = Domain::<String>::from_str("пример.испытание").unwrap();
assert_eq!(domain.as_inner(), "xn--e1afmkfd.xn--80akhbyknj4f");

let domain = Domain::<Arc<str>>::from_str("测试.中国").unwrap();
assert_eq!(domain.as_inner().as_ref(), "xn--0zwm56d.xn--fiqs8s");

let domain = Domain::<Arc<[u8]>>::try_from("test.com".as_bytes()).unwrap();
assert_eq!(domain.as_inner().as_ref(), b"test.com");

Implementations§

Source§

impl<S> Domain<Domain<S>>
where S: ?Sized,

Source

pub fn flatten(self) -> Domain<S>

Flattens a Domain<Domain<S>> into a Domain<S>.

Source

pub const fn flatten_const(self) -> Domain<S>
where S: Copy,

Flattens a Domain<Domain<S>> into a Domain<S>.

Source§

impl<S> Domain<S>
where S: ?Sized,

Source

pub const fn as_inner(&self) -> &S

Returns the reference to the inner S.

Source

pub fn into_inner(self) -> S

Returns the inner S.

Source

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

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

Source

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

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

Source

pub fn to_fqdn(&self) -> Option<Domain<Buffer>>
where S: AsRef<[u8]>,

Converts the domain to a fully qualified domain name (FQDN) by appending a dot (.) at the end if it is not already a FQDN.

Returns None if the domain is already a FQDN.

§Domain Length Constraints

Valid domain names are at most 253 bytes long (or 254 bytes with trailing dot for FQDN). Since validation ensures these constraints, this method will always succeed for valid domains.

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

// Regular domain to FQDN
let domain = Domain::<str>::try_from_ascii_str("example.com").unwrap();
let fqdn = domain.to_fqdn().unwrap();
assert_eq!(fqdn.as_ref().into_inner().as_str(), "example.com.");

// Already a FQDN
let domain = Domain::<str>::try_from_ascii_str("example.com.").unwrap();
assert!(domain.to_fqdn().is_none());

// Works with max-length domains (253 bytes)
let long_label = "a".repeat(63);
let long_domain = format!("{}.{}.{}.{}", long_label, long_label, long_label, &long_label[..61]);
let domain = Domain::<str>::try_from_ascii_str(&long_domain).unwrap();
assert_eq!(domain.as_ref().into_inner().len(), 253);
let fqdn = domain.to_fqdn().unwrap();
assert_eq!(fqdn.as_ref().into_inner().as_str().len(), 254);
Source

pub fn is_fqdn(&self) -> bool
where S: AsRef<[u8]>,

Returns true if the domain is a fully qualified domain name (FQDN).

A FQDN is a domain name that ends with a dot (.), representing the DNS root.

§Example
use hostaddr::Domain;

// Regular domain (not FQDN)
let domain = Domain::<str>::try_from_ascii_str("example.com").unwrap();
assert!(!domain.is_fqdn());

// FQDN (ends with dot)
let fqdn = Domain::<str>::try_from_ascii_str("example.com.").unwrap();
assert!(fqdn.is_fqdn());

// Root domain is a FQDN
let root = Domain::<str>::try_from_ascii_str(".").unwrap();
assert!(root.is_fqdn());
Source§

impl<S> Domain<&S>

Source

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

Maps an Domain<&S> to an Domain<S> by copying the contents of the domain.

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

let domain: Domain<Buffer> = Domain::try_from("example.com").unwrap();
assert_eq!("example.com", domain.as_ref().copied().as_inner().as_str());
Source

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

Maps an Domain<&S> to an Domain<S> by cloning the contents of the domain.

§Example
use hostaddr::Domain;

let domain: Domain<String> = "example.com".parse().unwrap();
assert_eq!("example.com", domain.as_ref().cloned().as_inner().as_str());
Source§

impl Domain<str>

Source

pub const fn try_from_ascii_str( input: &str, ) -> Result<&Domain<str>, ParseAsciiDomainError>

Parses a domain name from &str.

Unlike Domain::try_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::Domain;

let domain = Domain::try_from_ascii_str("example.com").unwrap();
assert_eq!(domain.as_ref().into_inner(), "example.com");

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

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

pub const fn as_bytes(&self) -> &Domain<[u8]>

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

§Example
use hostaddr::Domain;

let domain = Domain::try_from_ascii_str("example.com").unwrap();
assert_eq!(domain.as_bytes().as_ref().into_inner(), b"example.com");
Source§

impl Domain<[u8]>

Source

pub const fn try_from_ascii_bytes( input: &[u8], ) -> Result<&Domain<[u8]>, ParseAsciiDomainError>

Parses a domain name from &[u8].

Unlike Domain::try_from_bytes, 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::Domain;

let domain = Domain::try_from_ascii_bytes(b"example.com").unwrap();
assert_eq!(domain.as_ref().into_inner(), b"example.com");

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

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

pub const fn as_str(&self) -> &Domain<str>

Converts the domain to a Domain<str>.

§Example
use hostaddr::Domain;

let domain = Domain::try_from_ascii_bytes(b"example.com").unwrap();
assert_eq!(domain.as_str().as_ref().into_inner(), "example.com");
Source§

impl<S> Domain<S>

Source

pub fn try_from_bytes( input: S, ) -> Result<Either<Domain<S>, Buffer>, ParseDomainError>
where S: AsRef<[u8]>,

Parses a domain name from &[u8].

If you can make sure the input is ASCII and not percent encoded, then Domain::try_from_ascii_bytes should be used instead.

§Note
  1. If the given input is encoded in percent encoding, it will be decoded.
  2. If the given input is not ASCII, it will be converted to ASCII using punycode.
  3. Otherwise, the input will be returned as is.

If the 1. & 2. happen, the result will be returned as a Either::Right(Buffer).

If the input is not a valid domain name, this method will return an error.

§Example
use hostaddr::Domain;

let domain = Domain::try_from_bytes(b"example.com").unwrap();
assert_eq!(domain.unwrap_left().into_inner(), b"example.com");

let domain = Domain::try_from_bytes("测试.中国".as_bytes()).unwrap();
assert_eq!(domain.unwrap_right().as_bytes(), b"xn--0zwm56d.xn--fiqs8s");

let domain = Domain::try_from_bytes(b"example%2Ecom").unwrap();
assert_eq!(domain.unwrap_right().as_bytes(), b"example.com");

let domain = Domain::try_from_bytes("测试%2E中国".as_bytes()).unwrap();
assert_eq!(domain.unwrap_right().as_bytes(), b"xn--0zwm56d.xn--fiqs8s");
Source

pub fn try_from_str( input: S, ) -> Result<Either<Domain<S>, Buffer>, ParseDomainError>
where S: AsRef<str>,

Parses a domain name from &str.

If you can make sure the input is ASCII and not percent encoded, then Domain::try_from_ascii_str should be used instead.

§Note
  1. If the given input is encoded in percent encoding, it will be decoded.
  2. If the given input is not ASCII, it will be converted to ASCII using punycode.
  3. Otherwise, the input will be returned as is.

If the 1. & 2. happen, the result will be returned as a Either::Right(Buffer).

If the input is not a valid domain name, this method will return an error.

§Example
use hostaddr::Domain;

let domain = Domain::try_from_str("example.com").unwrap();
assert_eq!(domain.unwrap_left().into_inner(), "example.com");

let domain = Domain::try_from_str("测试.中国").unwrap();
assert_eq!(domain.unwrap_right().as_str(), "xn--0zwm56d.xn--fiqs8s");

let domain = Domain::try_from_str("example%2Ecom").unwrap();
assert_eq!(domain.unwrap_right().as_str(), "example.com");

let domain = Domain::try_from_str("测试%2E中国").unwrap();
assert_eq!(domain.unwrap_right().as_str(), "xn--0zwm56d.xn--fiqs8s");

Trait Implementations§

Source§

impl<S> AsRef<[u8]> for Domain<S>
where S: AsRef<[u8]>,

Source§

fn as_ref(&self) -> &[u8]

use hostaddr::Domain;
use std::borrow::Borrow;

let domain = Domain::<[u8]>::try_from_ascii_bytes(b"example.com").unwrap();
let bytes: &[u8] = AsRef::as_ref(&domain);

assert_eq!(bytes, b"example.com");
Source§

impl<S> AsRef<S> for Domain<S>
where S: ?Sized,

Source§

fn as_ref(&self) -> &S

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<S> AsRef<str> for Domain<S>
where S: AsRef<str>,

Source§

fn as_ref(&self) -> &str

use hostaddr::Domain;

let domain = Domain::<str>::try_from_ascii_str("example.com").unwrap();
let s: &str = AsRef::as_ref(&domain);

assert_eq!(s, "example.com");
Source§

impl<S> Borrow<S> for Domain<S>
where S: ?Sized,

Source§

fn borrow(&self) -> &S

use hostaddr::Domain;
use std::borrow::Borrow;

let domain = Domain::<[u8]>::try_from_ascii_bytes(b"example.com").unwrap();
let bytes: &[u8] = domain.borrow();

assert_eq!(bytes, b"example.com");
Source§

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

Source§

fn cheap_clone(&self) -> Self

Returns a copy of the value.
Source§

impl<S> Clone for Domain<S>
where S: Clone + ?Sized,

Source§

fn clone(&self) -> Domain<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 Domain<SmolStr>

Source§

type Ref<'a> = Domain<Buffer>

The reference type of the data.
Source§

fn from_ref( val: <Domain<SmolStr> as Data>::Ref<'_>, ) -> Result<Domain<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, Domain<SmolStr>> for Domain<Buffer>

Source§

fn decode(buf: &'a [u8]) -> Result<(usize, Domain<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 Domain<S>
where S: Debug + ?Sized,

Source§

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

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

impl<S> Display for Domain<S>
where S: Display + ?Sized,

Source§

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

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

impl From<&Domain<[u8]>> for Domain<Buffer>

Source§

fn from(value: &Domain<[u8]>) -> Domain<Buffer>

use hostaddr::{Domain, Buffer};

let domain: Domain<Buffer> = Domain::try_from_ascii_bytes(b"example.com").unwrap().into();
assert_eq!(domain.into_inner().as_bytes(), b"example.com");
Source§

impl From<&Domain<Buffer>> for Domain<Arc<[u8]>>

Source§

fn from(value: &Domain<Buffer>) -> Domain<Arc<[u8]>>

Converts to this type from the input type.
Source§

impl From<&Domain<Buffer>> for Domain<Arc<str>>

Source§

fn from(value: &Domain<Buffer>) -> Domain<Arc<str>>

Converts to this type from the input type.
Source§

impl From<&Domain<Buffer>> for Domain<Box<[u8]>>

Source§

fn from(value: &Domain<Buffer>) -> Domain<Box<[u8]>>

Converts to this type from the input type.
Source§

impl From<&Domain<Buffer>> for Domain<Box<str>>

Source§

fn from(value: &Domain<Buffer>) -> Domain<Box<str>>

Converts to this type from the input type.
Source§

impl From<&Domain<Buffer>> for Domain<Rc<[u8]>>

Source§

fn from(value: &Domain<Buffer>) -> Domain<Rc<[u8]>>

Converts to this type from the input type.
Source§

impl From<&Domain<Buffer>> for Domain<Rc<str>>

Source§

fn from(value: &Domain<Buffer>) -> Domain<Rc<str>>

Converts to this type from the input type.
Source§

impl From<&Domain<Buffer>> for Domain<SmolStr>

Source§

fn from(value: &Domain<Buffer>) -> Domain<SmolStr>

Converts to this type from the input type.
Source§

impl From<&Domain<Buffer>> for Domain<String>

Source§

fn from(value: &Domain<Buffer>) -> Domain<String>

Converts to this type from the input type.
Source§

impl From<&Domain<Buffer>> for Domain<Vec<u8>>

Source§

fn from(value: &Domain<Buffer>) -> Domain<Vec<u8>>

Converts to this type from the input type.
Source§

impl From<&Domain<str>> for Domain<Buffer>

Source§

fn from(value: &Domain<str>) -> Domain<Buffer>

use hostaddr::{Domain, Buffer};

let domain: Domain<Buffer> = Domain::try_from_ascii_str("example.com").unwrap().into();
assert_eq!(domain.into_inner().as_str(), "example.com");
Source§

impl From<Buffer> for Domain<Buffer>

Source§

fn from(value: Buffer) -> Domain<Buffer>

Converts to this type from the input type.
Source§

impl From<Domain<&[u8]>> for Domain<Buffer>

Source§

fn from(value: Domain<&[u8]>) -> Domain<Buffer>

use hostaddr::{Domain, Buffer};

let domain: Domain<Buffer> = Domain::try_from_ascii_bytes(b"example.com").unwrap().as_ref().into();
assert_eq!(domain.into_inner().as_str(), "example.com");
Source§

impl From<Domain<&str>> for Domain<Buffer>

Source§

fn from(value: Domain<&str>) -> Domain<Buffer>

use hostaddr::{Domain, Buffer};

let domain: Domain<Buffer> = Domain::try_from_ascii_str("example.com").unwrap().as_ref().into();
let buffer: Buffer = domain.into();
assert_eq!(buffer.as_str(), "example.com");

let domain: Domain<Buffer> = buffer.into();
assert_eq!(domain.into_inner().as_str(), "example.com");
Source§

impl From<Domain<Buffer>> for Buffer

Source§

fn from(value: Domain<Buffer>) -> Buffer

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<Arc<[u8]>>

Source§

fn from(value: Domain<Buffer>) -> Domain<Arc<[u8]>>

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<Arc<str>>

Source§

fn from(value: Domain<Buffer>) -> Domain<Arc<str>>

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<Box<[u8]>>

Source§

fn from(value: Domain<Buffer>) -> Domain<Box<[u8]>>

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<Box<str>>

Source§

fn from(value: Domain<Buffer>) -> Domain<Box<str>>

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<Rc<[u8]>>

Source§

fn from(value: Domain<Buffer>) -> Domain<Rc<[u8]>>

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<Rc<str>>

Source§

fn from(value: Domain<Buffer>) -> Domain<Rc<str>>

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<SmolStr>

Source§

fn from(value: Domain<Buffer>) -> Domain<SmolStr>

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<String>

Source§

fn from(value: Domain<Buffer>) -> Domain<String>

Converts to this type from the input type.
Source§

impl From<Domain<Buffer>> for Domain<Vec<u8>>

Source§

fn from(value: Domain<Buffer>) -> Domain<Vec<u8>>

Converts to this type from the input type.
Source§

impl<S> From<Domain<S>> for Host<S>

Source§

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

use hostaddr::{Domain, Host};

let domain: Domain<String> = "example.com".parse().unwrap();
let host: Host<String> = domain.into();
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 FromStr for Domain<Arc<[u8]>>

Source§

type Err = ParseDomainError

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

fn from_str( s: &str, ) -> Result<Domain<Arc<[u8]>>, <Domain<Arc<[u8]>> as FromStr>::Err>

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

impl FromStr for Domain<Arc<str>>

Source§

type Err = ParseDomainError

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

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

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

impl FromStr for Domain<Box<[u8]>>

Source§

type Err = ParseDomainError

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

fn from_str( s: &str, ) -> Result<Domain<Box<[u8]>>, <Domain<Box<[u8]>> as FromStr>::Err>

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

impl FromStr for Domain<Box<str>>

Source§

type Err = ParseDomainError

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

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

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

impl FromStr for Domain<Buffer>

Source§

type Err = ParseDomainError

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

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

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

impl FromStr for Domain<Rc<[u8]>>

Source§

type Err = ParseDomainError

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

fn from_str( s: &str, ) -> Result<Domain<Rc<[u8]>>, <Domain<Rc<[u8]>> as FromStr>::Err>

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

impl FromStr for Domain<Rc<str>>

Source§

type Err = ParseDomainError

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

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

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

impl FromStr for Domain<SmolStr>

Source§

type Err = ParseDomainError

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

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

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

impl FromStr for Domain<String>

Source§

type Err = ParseDomainError

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

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

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

impl FromStr for Domain<Vec<u8>>

Source§

type Err = ParseDomainError

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

fn from_str( s: &str, ) -> Result<Domain<Vec<u8>>, <Domain<Vec<u8>> as FromStr>::Err>

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

impl<S> Hash for Domain<S>
where S: Hash + ?Sized,

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 Domain<S>
where S: Ord + ?Sized,

Source§

fn cmp(&self, other: &Domain<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 Domain<S>
where S: PartialEq + ?Sized,

Source§

fn eq(&self, other: &Domain<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 Domain<S>
where S: PartialOrd + ?Sized,

Source§

fn partial_cmp(&self, other: &Domain<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> TryFrom<&'a [u8]> for Domain<Arc<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Arc<[u8]>>, <Domain<Arc<[u8]>> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<Arc<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Arc<str>>, <Domain<Arc<str>> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<Box<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Box<[u8]>>, <Domain<Box<[u8]>> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<Box<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Box<str>>, <Domain<Box<str>> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<Buffer>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Buffer>, <Domain<Buffer> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<Cow<'a, [u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Cow<'a, [u8]>>, <Domain<Cow<'a, [u8]>> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<Rc<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Rc<[u8]>>, <Domain<Rc<[u8]>> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<Rc<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Rc<str>>, <Domain<Rc<str>> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<SmolStr>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<SmolStr>, <Domain<SmolStr> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<String>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<String>, <Domain<String> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a [u8]> for Domain<Vec<u8>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a [u8], ) -> Result<Domain<Vec<u8>>, <Domain<Vec<u8>> as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Arc<[u8]>> for Domain<Arc<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a Arc<[u8]>, ) -> Result<Domain<Arc<[u8]>>, <Domain<Arc<[u8]>> as TryFrom<&'a Arc<[u8]>>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Arc<str>> for Domain<Arc<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a Arc<str>, ) -> Result<Domain<Arc<str>>, <Domain<Arc<str>> as TryFrom<&'a Arc<str>>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Box<[u8]>> for Domain<Box<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a Box<[u8]>, ) -> Result<Domain<Box<[u8]>>, <Domain<Box<[u8]>> as TryFrom<&'a Box<[u8]>>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Box<str>> for Domain<Box<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a Box<str>, ) -> Result<Domain<Box<str>>, <Domain<Box<str>> as TryFrom<&'a Box<str>>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Rc<[u8]>> for Domain<Rc<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a Rc<[u8]>, ) -> Result<Domain<Rc<[u8]>>, <Domain<Rc<[u8]>> as TryFrom<&'a Rc<[u8]>>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Rc<str>> for Domain<Rc<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a Rc<str>, ) -> Result<Domain<Rc<str>>, <Domain<Rc<str>> as TryFrom<&'a Rc<str>>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a SmolStr> for Domain<SmolStr>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a SmolStr, ) -> Result<Domain<SmolStr>, <Domain<SmolStr> as TryFrom<&'a SmolStr>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a String> for Domain<String>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a String, ) -> Result<Domain<String>, <Domain<String> as TryFrom<&'a String>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Vec<u8>> for Domain<Vec<u8>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a Vec<u8>, ) -> Result<Domain<Vec<u8>>, <Domain<Vec<u8>> as TryFrom<&'a Vec<u8>>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Arc<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Arc<[u8]>>, <Domain<Arc<[u8]>> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Arc<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Arc<str>>, <Domain<Arc<str>> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Box<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Box<[u8]>>, <Domain<Box<[u8]>> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Box<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Box<str>>, <Domain<Box<str>> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Buffer>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Buffer>, <Domain<Buffer> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Cow<'a, str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Cow<'a, str>>, <Domain<Cow<'a, str>> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Rc<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Rc<[u8]>>, <Domain<Rc<[u8]>> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Rc<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Rc<str>>, <Domain<Rc<str>> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<SmolStr>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<SmolStr>, <Domain<SmolStr> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<String>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<String>, <Domain<String> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Domain<Vec<u8>>

Source§

type Error = ParseDomainError

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

fn try_from( value: &'a str, ) -> Result<Domain<Vec<u8>>, <Domain<Vec<u8>> as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl TryFrom<Arc<[u8]>> for Domain<Arc<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: Arc<[u8]>, ) -> Result<Domain<Arc<[u8]>>, <Domain<Arc<[u8]>> as TryFrom<Arc<[u8]>>>::Error>

Performs the conversion.
Source§

impl TryFrom<Arc<str>> for Domain<Arc<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: Arc<str>, ) -> Result<Domain<Arc<str>>, <Domain<Arc<str>> as TryFrom<Arc<str>>>::Error>

Performs the conversion.
Source§

impl TryFrom<Box<[u8]>> for Domain<Box<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: Box<[u8]>, ) -> Result<Domain<Box<[u8]>>, <Domain<Box<[u8]>> as TryFrom<Box<[u8]>>>::Error>

Performs the conversion.
Source§

impl TryFrom<Box<str>> for Domain<Box<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: Box<str>, ) -> Result<Domain<Box<str>>, <Domain<Box<str>> as TryFrom<Box<str>>>::Error>

Performs the conversion.
Source§

impl TryFrom<Rc<[u8]>> for Domain<Rc<[u8]>>

Source§

type Error = ParseDomainError

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

fn try_from( value: Rc<[u8]>, ) -> Result<Domain<Rc<[u8]>>, <Domain<Rc<[u8]>> as TryFrom<Rc<[u8]>>>::Error>

Performs the conversion.
Source§

impl TryFrom<Rc<str>> for Domain<Rc<str>>

Source§

type Error = ParseDomainError

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

fn try_from( value: Rc<str>, ) -> Result<Domain<Rc<str>>, <Domain<Rc<str>> as TryFrom<Rc<str>>>::Error>

Performs the conversion.
Source§

impl TryFrom<SmolStr> for Domain<SmolStr>

Source§

type Error = ParseDomainError

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

fn try_from( value: SmolStr, ) -> Result<Domain<SmolStr>, <Domain<SmolStr> as TryFrom<SmolStr>>::Error>

Performs the conversion.
Source§

impl TryFrom<String> for Domain<String>

Source§

type Error = ParseDomainError

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

fn try_from( value: String, ) -> Result<Domain<String>, <Domain<String> as TryFrom<String>>::Error>

Performs the conversion.
Source§

impl TryFrom<Vec<u8>> for Domain<Vec<u8>>

Source§

type Error = ParseDomainError

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

fn try_from( value: Vec<u8>, ) -> Result<Domain<Vec<u8>>, <Domain<Vec<u8>> as TryFrom<Vec<u8>>>::Error>

Performs the conversion.
Source§

impl<S> Copy for Domain<S>
where S: Copy + ?Sized,

Source§

impl<S> Eq for Domain<S>
where S: Eq + ?Sized,

Source§

impl<S> StructuralPartialEq for Domain<S>
where S: ?Sized,

Auto Trait Implementations§

§

impl<S> Freeze for Domain<S>
where S: Freeze + ?Sized,

§

impl<S> RefUnwindSafe for Domain<S>
where S: RefUnwindSafe + ?Sized,

§

impl<S> Send for Domain<S>
where S: Send + ?Sized,

§

impl<S> Sync for Domain<S>
where S: Sync + ?Sized,

§

impl<S> Unpin for Domain<S>
where S: Unpin + ?Sized,

§

impl<S> UnwindSafe for Domain<S>
where S: UnwindSafe + ?Sized,

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,