1 // Copyright 2012-2014 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.
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.
11 //! # The Unicode Library
13 //! Unicode-intensive functions for `char` and `str` types.
15 //! This crate provides a collection of Unicode-related functionality,
16 //! including decompositions, conversions, etc., and provides traits
17 //! implementing these functions for the `char` and `str` types.
19 //! The functionality included here is only that which is necessary to
20 //! provide for basic string-related manipulations. This crate does not
21 //! (yet) aim to provide a full set of Unicode tables.
23 #![crate_name = "unicode"]
25 #![crate_type = "rlib"]
26 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
27 html_favicon_url = "http://www.rust-lang.org/favicon.ico",
28 html_root_url = "http://doc.rust-lang.org/nightly/",
29 html_playground_url = "http://play.rust-lang.org/")]
31 #![feature(globs, macro_rules, slicing_syntax, unboxed_closures)]
32 #![feature(associated_types)]
37 pub use tables::regex;
44 // re-export char so that std et al see it correctly
45 /// Character manipulation (`char` type, Unicode Scalar Value)
47 /// This module provides the `Char` and `UnicodeChar` traits, as well as their
48 /// implementation for the primitive `char` type, in order to allow basic character
51 /// A `char` actually represents a
52 /// *[Unicode Scalar Value](http://www.unicode.org/glossary/#unicode_scalar_value)*,
53 /// as it can contain any Unicode code point except high-surrogate and
54 /// low-surrogate code points.
56 /// As such, only values in the ranges \[0x0,0xD7FF\] and \[0xE000,0x10FFFF\]
57 /// (inclusive) are allowed. A `char` can always be safely cast to a `u32`;
58 /// however the converse is not always true due to the above range limits
59 /// and, as such, should be performed via the `from_u32` function..
61 pub use core::char::{MAX, from_u32, is_digit_radix, to_digit};
62 pub use core::char::{from_digit, escape_unicode, escape_default};
63 pub use core::char::{len_utf8_bytes, Char};
65 pub use normalize::{decompose_canonical, decompose_compatible, compose};
67 pub use tables::normalization::canonical_combining_class;
68 pub use tables::UNICODE_VERSION;
70 pub use u_char::{is_alphabetic, is_XID_start, is_XID_continue};
71 pub use u_char::{is_lowercase, is_uppercase, is_whitespace};
72 pub use u_char::{is_alphanumeric, is_control, is_digit};
73 pub use u_char::{to_uppercase, to_lowercase, width, UnicodeChar};
77 pub use u_str::{UnicodeStr, Words, Graphemes, GraphemeIndices};
78 pub use u_str::{utf8_char_width, is_utf16, Utf16Items, Utf16Item};
79 pub use u_str::{utf16_items, Utf16Encoder};
82 // this lets us use #[deriving(..)]