Domain

Struct Domain 

Source
pub struct Domain<S: ?Sized>(/* private fields */);
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: ?Sized> Domain<Domain<S>>

Source

pub fn flatten(self) -> Domain<S>
where S: Sized,

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

Source

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

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

Source§

impl<S: ?Sized> Domain<S>

Source

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

Returns the reference to the inner S.

Source

pub fn into_inner(self) -> S
where S: Sized,

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::Target>
where S: Deref,

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

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<&Self, 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<&Self, 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<Self, Buffer>, ParseDomainError>
where S: AsRef<[u8]>,

Available on crate features alloc or std only.

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<Self, Buffer>, ParseDomainError>
where S: AsRef<str>,

Available on crate features alloc or std only.

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<'a> Arbitrary<'a> for Domain<Arc<[u8]>>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Arc<[u8]>>

Available on crate feature triomphe_0_1 and (crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc)) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Arc<str>>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Arc<str>>

Available on crate feature triomphe_0_1 and (crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc)) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Box<[u8]>>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Box<str>>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Bytes>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Cow<'a, str>>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Rc<[u8]>>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Rc<str>>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<SmolStr>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<String>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<'a> Arbitrary<'a> for Domain<Vec<u8>>

Available on crate feature arbitrary and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

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

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

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

Available on crate feature triomphe_0_1 and (crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc)) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Arbitrary for Domain<Arc<str>>

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Arbitrary for Domain<Arc<str>>

Available on crate feature triomphe_0_1 and (crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc)) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

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

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Arbitrary for Domain<Box<str>>

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Arbitrary for Domain<Bytes>

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

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

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Arbitrary for Domain<Rc<str>>

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Arbitrary for Domain<SmolStr>

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Arbitrary for Domain<String>

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Arbitrary for Domain<Vec<u8>>

Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
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: ?Sized> AsRef<S> for Domain<S>

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: ?Sized> Borrow<S> for Domain<S>

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> CheapClone for Domain<S>

Available on crate feature cheap-clone only.
Source§

fn cheap_clone(&self) -> Self

Returns a copy of the value.
Source§

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

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<S: Debug + ?Sized> Debug for Domain<S>

Source§

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

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

impl<'de, S> Deserialize<'de> for Domain<S>
where S: Deserialize<'de> + ?Sized,

Source§

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

Source§

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

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

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

Source§

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

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<str>> for Domain<Buffer>

Source§

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

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) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

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>) -> Self

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>) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

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>) -> Self

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]>>

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

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

Available on crate feature triomphe_0_1 only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<Arc<str>>

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<Arc<str>>

Available on crate feature triomphe_0_1 only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

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

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<Box<str>>

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<Buffer>

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<Bytes>

Available on crate feature bytes_1 only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

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

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<Rc<str>>

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl<const N: usize> FromStr for Domain<SmallVec<[u8; N]>>

Available on crate feature smallvec_1 only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<SmolStr>

Available on crate feature smol_str_0_3 only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<String>

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl<const N: usize> FromStr for Domain<TinyVec<[u8; N]>>

Available on crate feature tinyvec_1 only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl FromStr for Domain<Vec<u8>>

Available on crate features alloc or std only.
Source§

type Err = ParseDomainError

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

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

Source§

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

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 + ?Sized> Ord for Domain<S>

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 + ?Sized> PartialEq for Domain<S>

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 + ?Sized> PartialOrd for Domain<S>

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

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature triomphe_0_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature triomphe_0_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature bytes_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, const N: usize> TryFrom<&'a [u8]> for Domain<SmallVec<[u8; N]>>

Available on crate feature smallvec_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature smol_str_0_3 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, const N: usize> TryFrom<&'a [u8]> for Domain<TinyVec<[u8; N]>>

Available on crate feature tinyvec_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate feature triomphe_0_1 only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate feature triomphe_0_1 only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate feature bytes_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a Bytes) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

impl<'a, const N: usize> TryFrom<&'a SmallVec<[u8; N]>> for Domain<SmallVec<[u8; N]>>

Available on crate feature smallvec_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a SmallVec<[u8; N]>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature smol_str_0_3 only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

impl<'a, const N: usize> TryFrom<&'a TinyVec<[u8; N]>> for Domain<TinyVec<[u8; N]>>

Available on crate feature tinyvec_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a TinyVec<[u8; N]>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature triomphe_0_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature triomphe_0_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature bytes_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, const N: usize> TryFrom<&'a str> for Domain<SmallVec<[u8; N]>>

Available on crate feature smallvec_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature smol_str_0_3 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, const N: usize> TryFrom<&'a str> for Domain<TinyVec<[u8; N]>>

Available on crate feature tinyvec_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate feature triomphe_0_1 only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: Arc<str>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate feature triomphe_0_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: Arc<str>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: Box<str>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Bytes> for Domain<Bytes>

Available on crate feature bytes_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: Bytes) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

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

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: Rc<str>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<const N: usize> TryFrom<SmallVec<[u8; N]>> for Domain<SmallVec<[u8; N]>>

Available on crate feature smallvec_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: SmallVec<[u8; N]>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<SmolStr> for Domain<SmolStr>

Available on crate feature smol_str_0_3 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: SmolStr) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<String> for Domain<String>

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: String) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<const N: usize> TryFrom<TinyVec<[u8; N]>> for Domain<TinyVec<[u8; N]>>

Available on crate feature tinyvec_1 only.
Source§

type Error = ParseDomainError

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

fn try_from(value: TinyVec<[u8; N]>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Available on crate features alloc or std only.
Source§

type Error = ParseDomainError

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

fn try_from(value: Vec<u8>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Source§

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

Source§

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

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T