|
9 | 9 | // option. This file may not be copied, modified, or distributed |
10 | 10 | // except according to those terms. |
11 | 11 |
|
| 12 | + |
| 13 | +#![forbid(unsafe_code)] |
| 14 | +#![deny(missing_docs)] |
| 15 | + |
12 | 16 | //! # UNIC — Unicode IDNA Compatibility Processing |
13 | 17 | //! |
14 | | -//! This UNIC component implements algorithms from [Unicode® Technical Standard #46 - Unicode IDNA |
| 18 | +//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/). |
| 19 | +//! |
| 20 | +//! This UNIC component implements algorithms from [Unicode Technical Standard #46 - Unicode IDNA |
15 | 21 | //! Compatibility Processing](http://unicode.org/reports/tr46/). |
16 | 22 | //! |
17 | 23 | //! Quoting from [UTS #46’s introduction](http://www.unicode.org/reports/tr46/#Introduction): |
@@ -67,8 +73,10 @@ pub const PKG_NAME: &'static str = env!("CARGO_PKG_NAME"); |
67 | 73 | pub const PKG_DESCRIPTION: &'static str = env!("CARGO_PKG_DESCRIPTION"); |
68 | 74 |
|
69 | 75 |
|
| 76 | +/// Prefix used in Punycode encoding. |
70 | 77 | pub static PUNYCODE_PREFIX: &'static str = "xn--"; |
71 | 78 |
|
| 79 | + |
72 | 80 | fn map_char(codepoint: char, flags: Flags, output: &mut String, errors: &mut Vec<Error>) { |
73 | 81 | match *find_char(codepoint) { |
74 | 82 | Mapping::Valid => output.push(codepoint), |
@@ -360,13 +368,16 @@ fn processing(domain: &str, flags: Flags, errors: &mut Vec<Error>) -> String { |
360 | 368 | validated |
361 | 369 | } |
362 | 370 |
|
| 371 | +/// Optional settings for processing and conversion algorithms. |
363 | 372 | #[derive(Copy, Clone)] |
| 373 | +#[allow(missing_docs)] |
364 | 374 | pub struct Flags { |
365 | 375 | pub use_std3_ascii_rules: bool, |
366 | 376 | pub transitional_processing: bool, |
367 | 377 | pub verify_dns_length: bool, |
368 | 378 | } |
369 | 379 |
|
| 380 | +/// Error types recorded during UTS #46 processing. |
370 | 381 | #[derive(PartialEq, Eq, Clone, Copy, Debug)] |
371 | 382 | enum Error { |
372 | 383 | PunycodeError, |
|
0 commit comments