hostaddr

Crates.iohostaddr
lib.rshostaddr
version0.1.7
created_at2025-03-26 10:15:48.007254+00
updated_at2025-04-28 09:16:05.932188+00
descriptionExtended types (`Domain`, `Host`, `HostAddr`) for working with net in Rust.
homepagehttps://github.com/al8n/hostaddr
repositoryhttps://github.com/al8n/hostaddr
max_upload_size
id1606392
size159,381
Al Liu (al8n)

documentation

https://docs.rs/hostaddr

README

hostaddr

Extended types (Domain, Host, HostAddr) for working with net in Rust.

github LoC Build codecov

docs.rs crates.io crates.io license

English | 简体中文

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.

Commit count: 9

cargo fmt