1// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
11//! Detect possible security problems with Unicode usage according to
12//! [Unicode Technical Standard #39](http://www.unicode.org/reports/tr39/)
13//! rules.
14//!
15//! ```rust
16//! extern crate unicode_security;
17//!
18//! use unicode_security::GeneralSecurityProfile;
19//!
20//! fn main() {
21//! let ch = 'µ'; // U+00B5 MICRO SIGN
22//! let allowed = 'µ'.identifier_allowed();
23//! println!("{}", ch);
24//! println!("The above char is {} in unicode identifiers.",
25//! if allowed { "allowed" } else { "restricted" });
26//! }
27//! ```
28//!
29//! # features
30//!
31//! unicode-security supports a `no_std` feature. This eliminates dependence
32//! on std, and instead uses equivalent functions from core.
33//!
34//! # crates.io
35//!
36//! You can use this package in your project by adding the following
37//! to your `Cargo.toml`:
38//!
39//! ```toml
40//! [dependencies]
41//! unicode-security = "0.0.1"
42//! ```
43
44#![deny(missing_docs, unsafe_code)]
45#![doc(
46 html_logo_url = "https://unicode-rs.github.io/unicode-rs_sm.png",
47 html_favicon_url = "https://unicode-rs.github.io/unicode-rs_sm.png"
48)]
49#![cfg_attr(feature = "bench", feature(test))]
50#![no_std]
51
52#[cfg(test)]
53#[macro_use]
54extern crate std;
55
56#[cfg(feature = "bench")]
57extern crate test;
58
59pub use tables::UNICODE_VERSION;
60
61pub mod confusable_detection;
62pub mod general_security_profile;
63pub mod mixed_script;
64pub mod restriction_level;
65
66pub use confusable_detection::skeleton;
67pub use general_security_profile::GeneralSecurityProfile;
68pub use mixed_script::is_potential_mixed_script_confusable_char;
69pub use mixed_script::MixedScript;
70pub use restriction_level::{RestrictionLevel, RestrictionLevelDetection};
71
72#[rustfmt::skip]
73pub(crate) mod tables;
74
75#[cfg(test)]
76mod tests;
77