unic_idna/
lib.rs

1// Copyright 2016 The rust-url developers.
2// Copyright 2017 The UNIC Project Developers.
3//
4// See the COPYRIGHT file at the top-level directory of this distribution.
5//
6// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9// option. This file may not be copied, modified, or distributed
10// except according to those terms.
11
12#![warn(
13    bad_style,
14    missing_debug_implementations,
15    missing_docs,
16    unconditional_recursion
17)]
18#![forbid(unsafe_code)]
19
20//! # UNIC — Unicode IDNA Compatibility Processing
21//!
22//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
23//!
24//! This UNIC component implements algorithms from [Unicode Technical Standard #46 - Unicode IDNA
25//! Compatibility Processing](http://unicode.org/reports/tr46/).
26//!
27//! Quoting from [UTS #46’s introduction](https://www.unicode.org/reports/tr46/#Introduction):
28//!
29//! > Initially, domain names were restricted to ASCII characters.
30//! > A system was introduced in 2003 for internationalized domain names (IDN).
31//! > This system is called Internationalizing Domain Names for Applications,
32//! > or *IDNA2003* for short.
33//! > This mechanism supports IDNs by means of a client software transformation
34//! > into a format known as Punycode.
35//! >
36//! > A revision of IDNA was approved in 2010 (*IDNA2008*).
37//! > This revision has a number of incompatibilities with IDNA2003.
38//! >
39//! > The incompatibilities force implementers of client software,
40//! > such as browsers and emailers,
41//! > to face difficult choices during the transition period
42//! > as registries shift from IDNA2003 to IDNA2008.
43//! > This document specifies a mechanism
44//! > that minimizes the impact of this transition for client software,
45//! > allowing client software to access domains that are valid under either system.
46
47#[macro_use]
48extern crate matches;
49
50use unic_idna_mapping as mapping;
51use unic_idna_punycode as punycode;
52
53mod pkg_info;
54pub use crate::pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
55
56pub use crate::mapping::UNICODE_VERSION;
57
58mod process;
59pub use crate::process::PUNYCODE_PREFIX;
60pub use crate::process::{to_ascii, to_unicode};
61pub use crate::process::{Errors, Flags};