ascii_domain

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

lib.rs (2697B)


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