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<S>
impl<S: ?Sized> Domain<S>
Sourcepub fn into_inner(self) -> Swhere
S: Sized,
pub fn into_inner(self) -> Swhere
S: Sized,
Returns the inner S.
Source§impl<S> Domain<&S>
impl<S> Domain<&S>
Sourcepub const fn copied(self) -> Domain<S>where
S: Copy,
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§impl Domain<str>
impl Domain<str>
Sourcepub const fn try_from_ascii_str(
input: &str,
) -> Result<&Self, ParseAsciiDomainError>
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§impl Domain<[u8]>
impl Domain<[u8]>
Sourcepub const fn try_from_ascii_bytes(
input: &[u8],
) -> Result<&Self, ParseAsciiDomainError>
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§impl<S> Domain<S>
impl<S> Domain<S>
Sourcepub fn try_from_bytes(
input: S,
) -> Result<Either<Self, Buffer>, ParseDomainError>
Available on crate features alloc or std only.
pub fn try_from_bytes( input: S, ) -> Result<Either<Self, Buffer>, ParseDomainError>
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
- If the given input is encoded in percent encoding, it will be decoded.
- If the given input is not ASCII, it will be converted to ASCII using punycode.
- 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");Sourcepub fn try_from_str(input: S) -> Result<Either<Self, Buffer>, ParseDomainError>
Available on crate features alloc or std only.
pub fn try_from_str(input: S) -> Result<Either<Self, Buffer>, ParseDomainError>
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
- If the given input is encoded in percent encoding, it will be decoded.
- If the given input is not ASCII, it will be converted to ASCII using punycode.
- 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.
impl<'a> Arbitrary<'a> for Domain<Arc<[u8]>>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Arc<[u8]>>
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>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Arc<str>>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Arc<str>>
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>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Box<[u8]>>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Box<str>>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Bytes>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Cow<'a, str>>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Rc<[u8]>>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Rc<str>>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<SmolStr>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<String>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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.
impl<'a> Arbitrary<'a> for Domain<Vec<u8>>
arbitrary and (crate features std or alloc), or (crate features std or alloc) only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Arbitrary for Domain<Arc<[u8]>>
Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
impl Arbitrary for Domain<Arc<[u8]>>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.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.
impl Arbitrary for Domain<Arc<[u8]>>
triomphe_0_1 and (crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc)) only.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.
impl Arbitrary for Domain<Arc<str>>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.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.
impl Arbitrary for Domain<Arc<str>>
triomphe_0_1 and (crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc)) only.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.
impl Arbitrary for Domain<Box<[u8]>>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.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.
impl Arbitrary for Domain<Box<str>>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.Source§impl Arbitrary for Domain<Bytes>
Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
impl Arbitrary for Domain<Bytes>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.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.
impl Arbitrary for Domain<Rc<[u8]>>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.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.
impl Arbitrary for Domain<Rc<str>>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.Source§impl Arbitrary for Domain<SmolStr>
Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
impl Arbitrary for Domain<SmolStr>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.Source§impl Arbitrary for Domain<String>
Available on crate feature quickcheck and (crate features std or alloc), or (crate features std or alloc) only.
impl Arbitrary for Domain<String>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.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.
impl Arbitrary for Domain<Vec<u8>>
quickcheck and (crate features std or alloc), or (crate features std or alloc) only.Source§impl<S: CheapClone> CheapClone for Domain<S>
Available on crate feature cheap-clone only.
impl<S: CheapClone> CheapClone for Domain<S>
cheap-clone only.Source§fn cheap_clone(&self) -> Self
fn cheap_clone(&self) -> Self
Source§impl<'de, S> Deserialize<'de> for Domain<S>where
S: Deserialize<'de> + ?Sized,
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>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Domain<&str>> for Domain<Buffer>
impl From<Domain<&str>> for Domain<Buffer>
Source§fn from(value: Domain<&str>) -> Self
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<const N: usize> FromStr for Domain<SmallVec<[u8; N]>>
Available on crate feature smallvec_1 only.
impl<const N: usize> FromStr for Domain<SmallVec<[u8; N]>>
smallvec_1 only.Source§impl<const N: usize> FromStr for Domain<TinyVec<[u8; N]>>
Available on crate feature tinyvec_1 only.
impl<const N: usize> FromStr for Domain<TinyVec<[u8; N]>>
tinyvec_1 only.Source§impl<S: Ord + ?Sized> Ord for Domain<S>
impl<S: Ord + ?Sized> Ord for Domain<S>
Source§impl<S: PartialOrd + ?Sized> PartialOrd for Domain<S>
impl<S: PartialOrd + ?Sized> PartialOrd for Domain<S>
Source§impl<'a> TryFrom<&'a [u8]> for Domain<Arc<[u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a [u8]> for Domain<Arc<[u8]>>
alloc or std only.Source§impl<'a> TryFrom<&'a [u8]> for Domain<Arc<[u8]>>
Available on crate feature triomphe_0_1 only.
impl<'a> TryFrom<&'a [u8]> for Domain<Arc<[u8]>>
triomphe_0_1 only.Source§impl<'a> TryFrom<&'a [u8]> for Domain<Arc<str>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a [u8]> for Domain<Arc<str>>
alloc or std only.Source§impl<'a> TryFrom<&'a [u8]> for Domain<Box<[u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a [u8]> for Domain<Box<[u8]>>
alloc or std only.Source§impl<'a> TryFrom<&'a [u8]> for Domain<Box<str>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a [u8]> for Domain<Box<str>>
alloc or std only.Source§impl<'a> TryFrom<&'a [u8]> for Domain<Cow<'a, [u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a [u8]> for Domain<Cow<'a, [u8]>>
alloc or std only.Source§impl<'a> TryFrom<&'a [u8]> for Domain<Rc<[u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a [u8]> for Domain<Rc<[u8]>>
alloc or std only.Source§impl<'a, const N: usize> TryFrom<&'a [u8]> for Domain<SmallVec<[u8; N]>>
Available on crate feature smallvec_1 only.
impl<'a, const N: usize> TryFrom<&'a [u8]> for Domain<SmallVec<[u8; N]>>
smallvec_1 only.Source§impl<'a, const N: usize> TryFrom<&'a [u8]> for Domain<TinyVec<[u8; N]>>
Available on crate feature tinyvec_1 only.
impl<'a, const N: usize> TryFrom<&'a [u8]> for Domain<TinyVec<[u8; N]>>
tinyvec_1 only.Source§impl<'a> TryFrom<&'a Arc<[u8]>> for Domain<Arc<[u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a Arc<[u8]>> for Domain<Arc<[u8]>>
alloc or std only.Source§impl<'a> TryFrom<&'a Arc<[u8]>> for Domain<Arc<[u8]>>
Available on crate feature triomphe_0_1 only.
impl<'a> TryFrom<&'a Arc<[u8]>> for Domain<Arc<[u8]>>
triomphe_0_1 only.Source§impl<'a> TryFrom<&'a Arc<str>> for Domain<Arc<str>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a Arc<str>> for Domain<Arc<str>>
alloc or std only.Source§impl<'a> TryFrom<&'a Arc<str>> for Domain<Arc<str>>
Available on crate feature triomphe_0_1 only.
impl<'a> TryFrom<&'a Arc<str>> for Domain<Arc<str>>
triomphe_0_1 only.Source§impl<'a> TryFrom<&'a Box<[u8]>> for Domain<Box<[u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a Box<[u8]>> for Domain<Box<[u8]>>
alloc or std only.Source§impl<'a> TryFrom<&'a Box<str>> for Domain<Box<str>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a Box<str>> for Domain<Box<str>>
alloc or std only.Source§impl<'a> TryFrom<&'a Rc<[u8]>> for Domain<Rc<[u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a Rc<[u8]>> for Domain<Rc<[u8]>>
alloc or std only.Source§impl<'a> TryFrom<&'a Rc<str>> for Domain<Rc<str>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a Rc<str>> for Domain<Rc<str>>
alloc or std only.Source§impl<'a, const N: usize> TryFrom<&'a SmallVec<[u8; N]>> for Domain<SmallVec<[u8; N]>>
Available on crate feature smallvec_1 only.
impl<'a, const N: usize> TryFrom<&'a SmallVec<[u8; N]>> for Domain<SmallVec<[u8; N]>>
smallvec_1 only.Source§impl<'a> TryFrom<&'a SmolStr> for Domain<SmolStr>
Available on crate feature smol_str_0_3 only.
impl<'a> TryFrom<&'a SmolStr> for Domain<SmolStr>
smol_str_0_3 only.Source§impl<'a> TryFrom<&'a String> for Domain<String>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a String> for Domain<String>
alloc or std only.Source§impl<'a, const N: usize> TryFrom<&'a TinyVec<[u8; N]>> for Domain<TinyVec<[u8; N]>>
Available on crate feature tinyvec_1 only.
impl<'a, const N: usize> TryFrom<&'a TinyVec<[u8; N]>> for Domain<TinyVec<[u8; N]>>
tinyvec_1 only.Source§impl<'a> TryFrom<&'a Vec<u8>> for Domain<Vec<u8>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a Vec<u8>> for Domain<Vec<u8>>
alloc or std only.Source§impl<'a> TryFrom<&'a str> for Domain<Arc<[u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a str> for Domain<Arc<[u8]>>
alloc or std only.Source§impl<'a> TryFrom<&'a str> for Domain<Box<[u8]>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a str> for Domain<Box<[u8]>>
alloc or std only.Source§impl<'a> TryFrom<&'a str> for Domain<Cow<'a, str>>
Available on crate features alloc or std only.
impl<'a> TryFrom<&'a str> for Domain<Cow<'a, str>>
alloc or std only.Source§impl<'a, const N: usize> TryFrom<&'a str> for Domain<SmallVec<[u8; N]>>
Available on crate feature smallvec_1 only.
impl<'a, const N: usize> TryFrom<&'a str> for Domain<SmallVec<[u8; N]>>
smallvec_1 only.Source§impl<'a, const N: usize> TryFrom<&'a str> for Domain<TinyVec<[u8; N]>>
Available on crate feature tinyvec_1 only.
impl<'a, const N: usize> TryFrom<&'a str> for Domain<TinyVec<[u8; N]>>
tinyvec_1 only.Source§impl<const N: usize> TryFrom<SmallVec<[u8; N]>> for Domain<SmallVec<[u8; N]>>
Available on crate feature smallvec_1 only.
impl<const N: usize> TryFrom<SmallVec<[u8; N]>> for Domain<SmallVec<[u8; N]>>
smallvec_1 only.Source§impl<const N: usize> TryFrom<TinyVec<[u8; N]>> for Domain<TinyVec<[u8; N]>>
Available on crate feature tinyvec_1 only.
impl<const N: usize> TryFrom<TinyVec<[u8; N]>> for Domain<TinyVec<[u8; N]>>
tinyvec_1 only.impl<S: Copy + ?Sized> Copy for Domain<S>
impl<S: Eq + ?Sized> Eq for Domain<S>
impl<S: ?Sized> StructuralPartialEq for Domain<S>
Auto Trait Implementations§
impl<S> Freeze for Domain<S>
impl<S> RefUnwindSafe for Domain<S>where
S: RefUnwindSafe + ?Sized,
impl<S> Send for Domain<S>
impl<S> Sync for Domain<S>
impl<S> Unpin for Domain<S>
impl<S> UnwindSafe for Domain<S>where
S: UnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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