Expand description
hostaddr
§Installation
[dependencies]
hostaddr = "0.1"
§Example
ⓘ
use hostaddr::HostAddr;
// parse domain to String
let addr: HostAddr<String> = "example.com".parse().unwrap();
// parse domain with port to Arc<str>
let addr: HostAddr<std::sync::Arc<str>> = "example.com:8080".parse().unwrap();
// parse domain to Vec<u8>
let addr: HostAddr<Vec<u8>> = "example.com".parse().unwrap();
// parse a fully qualified domain name with port to Box<str>
let addr: HostAddr<Box<str>> = "example.com.:8080".parse().unwrap();
§License
hostaddr
is under the terms of both the MIT license and the
Apache License (Version 2.0).
See LICENSE-APACHE, LICENSE-MIT for details.
Copyright (c) 2025 Al Liu.
Structs§
- Buffer
- An immutable buffer which contains a valid domain.
- Domain
- 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. - Host
Addr - A host address, which is consit of a
Host
and an optional port number. - Parse
Ascii Domain Error - The provided input could not be parsed because it is not an ASCII syntactically-valid DNS Domain.
- Parse
Ascii Host Error - An error which can be returned when parsing an ASCII
Host
. - Parse
Domain Error - The provided input could not be parsed because it is not a syntactically-valid DNS Domain.
- Parse
Host Error - An error which can be returned when parsing a
Host
. - TryUnwrap
Error - Error returned by the derived
TryUnwrap
implementation.
Enums§
- Host
- The host name
- Parse
Ascii Host Addr Error - An error which can be returned when parsing a
HostAddr
. - Parse
Host Addr Error - An error which can be returned when parsing a
HostAddr
.
Functions§
- verify_
ascii_ domain - Verifies that the input is a valid ASCII domain name.
- verify_
ascii_ domain_ allow_ percent_ encoding - Verifies that the input is a valid ASCII domain name. The input can be a percent-encoded domain name.
- verify_
domain alloc
orstd
- Verifies that the input is a valid domain name.