precis_profiles/
lib.rs

1//! PRECIS Framework: Preparation, Enforcement, and Comparison of
2//! Internationalized Strings in Application Protocols as described in
3//! [`rfc8264`](https://datatracker.ietf.org/doc/html/rfc8264)
4//!
5//! This crate implements the next PRECIS profiles:
6//! * [`rfc8265`](https://datatracker.ietf.org/doc/html/rfc8265).
7//!   Preparation, Enforcement, and Comparison of Internationalized Strings
8//!   Representing `Usernames` and `Passwords`.
9//! * [`rfc8266`](https://datatracker.ietf.org/doc/html/rfc8266).
10//!   Preparation, Enforcement, and Comparison of Internationalized Strings
11//!   Representing Nicknames
12//!
13//! ```rust
14//! # use precis_core::profile::PrecisFastInvocation;
15//! # use precis_profiles::Nickname;
16//! # use std::borrow::Cow;
17//! assert_eq!(Nickname::prepare("Guybrush Threepwood"),
18//!   Ok(Cow::from("Guybrush Threepwood")));
19//! assert_eq!(Nickname::enforce("   Guybrush     Threepwood  "),
20//!   Ok(Cow::from("Guybrush Threepwood")));
21//! assert_eq!(Nickname::compare("Guybrush   Threepwood  ",
22//!   "guybrush threepwood"), Ok(true));
23//! ```
24
25#![deny(missing_docs)]
26
27include!(concat!(env!("OUT_DIR"), "/unicode_version.rs"));
28
29mod bidi;
30mod common;
31mod nicknames;
32mod passwords;
33mod usernames;
34
35pub use crate::nicknames::Nickname;
36pub use crate::passwords::OpaqueString;
37pub use crate::usernames::UsernameCaseMapped;
38pub use crate::usernames::UsernameCasePreserved;
39pub use precis_core;