ascii_domain

Domains whose labels are only ASCII.
git clone https://git.philomathiclife.com/repos/ascii_domain
Log | Files | Refs | README

lib.rs (3162B)


      1 //! [![git]](https://git.philomathiclife.com/ascii_domain/log.html) [![crates-io]](https://crates.io/crates/ascii_domain) [![docs-rs]](crate)
      2 //!
      3 //! [git]: https://git.philomathiclife.com/git_badge.svg
      4 //! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
      5 //! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs
      6 //!
      7 //! `ascii_domain` is a library for efficiently parsing domains based on a supplied ASCII character set one
      8 //! wants to enforce each [`dom::Label`] to conform to. The primary type in the library is [`dom::Domain`]
      9 //! which can be thought of as domains in _representation_ format. Technically since any ASCII `u8` except
     10 //! `b'.'` is allowed in a `Label`, it is more general than an actual representation format that doesn’t
     11 //! include some form of escape characters. For a full-fledged DNS library look elsewhere (e.g.,
     12 //! [`domain`](https://docs.rs/domain/latest/domain/)).
     13 //!
     14 //! The purpose of this library is to allow efficient customization of domain name parsing while still retaining
     15 //! the hierarchical structure of a domain. Depending on one’s use case, allowed formats and characters can
     16 //! differ. If one wants to conform to the [Domain Name System (DNS)](https://www.rfc-editor.org/rfc/rfc2181),
     17 //! all octets are allowed; but conforming to [RFC 1123](https://www.rfc-editor.org/rfc/rfc1123) or
     18 //! [RFC 5891](https://datatracker.ietf.org/doc/html/rfc5891) requires stricter formats and a reduced character
     19 //! set.
     20 #![cfg_attr(docsrs, feature(doc_cfg))]
     21 #![no_std]
     22 #![deny(
     23     future_incompatible,
     24     let_underscore,
     25     missing_docs,
     26     nonstandard_style,
     27     rust_2018_compatibility,
     28     rust_2018_idioms,
     29     rust_2021_compatibility,
     30     rust_2024_compatibility,
     31     unsafe_code,
     32     unused,
     33     warnings,
     34     clippy::all,
     35     clippy::cargo,
     36     clippy::complexity,
     37     clippy::correctness,
     38     clippy::nursery,
     39     clippy::pedantic,
     40     clippy::perf,
     41     clippy::restriction,
     42     clippy::style,
     43     clippy::suspicious
     44 )]
     45 #![expect(
     46     clippy::blanket_clippy_restriction_lints,
     47     clippy::arbitrary_source_item_ordering,
     48     clippy::exhaustive_enums,
     49     clippy::implicit_return,
     50     clippy::min_ident_chars,
     51     clippy::missing_trait_methods,
     52     clippy::question_mark_used,
     53     clippy::single_char_lifetime_names,
     54     reason = "noisy, opinionated, and likely doesn't prevent bugs or improve APIs"
     55 )]
     56 /// Contains [`char_set::AllowedAscii`] which is how one dictates the character set [`dom::Domain::try_from_bytes`]
     57 /// uses.
     58 pub mod char_set;
     59 /// Contains [`dom::Domain`] which is a domain whose [`dom::Label`]s consist of a subset of the supplied
     60 /// [`char_set::AllowedAscii`].
     61 ///
     62 /// Also contains [`dom::Rfc1123Domain`] which is a `Domain` that conforms to
     63 /// [RFC 1123](https://www.rfc-editor.org/rfc/rfc1123#page-13).
     64 pub mod dom;
     65 /// Contains a Serde [`Visitor`](https://docs.rs/serde/latest/serde/de/trait.Visitor.html) that can be used to help
     66 /// deserialize [`dom::Domain`] wrappers.
     67 #[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
     68 #[cfg(feature = "serde")]
     69 pub mod serde;