about summary refs log tree commit diff
path: root/src/libstd/lib.rs
diff options
context:
space:
mode:
authorkwantam <kwantam@gmail.com>2014-06-30 17:04:10 -0400
committerkwantam <kwantam@gmail.com>2014-07-07 14:52:24 -0400
commit5d4238b6fc8769c35ff5818ed04d16a6deab784f (patch)
tree085ec3efe2b40fabad3603104a2f93f00df6926a /src/libstd/lib.rs
parent4f120e6bafe971452adfede158a7957b00562a4e (diff)
downloadrust-5d4238b6fc8769c35ff5818ed04d16a6deab784f.tar.gz
rust-5d4238b6fc8769c35ff5818ed04d16a6deab784f.zip
Add libunicode; move unicode functions from core
- created new crate, libunicode, below libstd
- split Char trait into Char (libcore) and UnicodeChar (libunicode)
  - Unicode-aware functions now live in libunicode
    - is_alphabetic, is_XID_start, is_XID_continue, is_lowercase,
      is_uppercase, is_whitespace, is_alphanumeric, is_control,
      is_digit, to_uppercase, to_lowercase
  - added width method in UnicodeChar trait
    - determines printed width of character in columns, or None if it is
      a non-NULL control character
    - takes a boolean argument indicating whether the present context is
      CJK or not (characters with 'A'mbiguous widths are double-wide in
      CJK contexts, single-wide otherwise)
- split StrSlice into StrSlice (libcore) and UnicodeStrSlice
  (libunicode)
  - functionality formerly in StrSlice that relied upon Unicode
    functionality from Char is now in UnicodeStrSlice
    - words, is_whitespace, is_alphanumeric, trim, trim_left, trim_right
  - also moved Words type alias into libunicode because words method is
    in UnicodeStrSlice
- unified Unicode tables from libcollections, libcore, and libregex into
  libunicode
- updated unicode.py in src/etc to generate aforementioned tables
- generated new tables based on latest Unicode data
- added UnicodeChar and UnicodeStrSlice traits to prelude
- libunicode is now the collection point for the std::char module,
  combining the libunicode functionality with the Char functionality
  from libcore
  - thus, moved doc comment for char from core::char to unicode::char
- libcollections remains the collection point for std::str

The Unicode-aware functions that previously lived in the Char and
StrSlice traits are no longer available to programs that only use
libcore. To regain use of these methods, include the libunicode crate
and use the UnicodeChar and/or UnicodeStrSlice traits:

    extern crate unicode;
    use unicode::UnicodeChar;
    use unicode::UnicodeStrSlice;
    use unicode::Words; // if you want to use the words() method

NOTE: this does *not* impact programs that use libstd, since UnicodeChar
and UnicodeStrSlice have been added to the prelude.

closes #15224
[breaking-change]
Diffstat (limited to 'src/libstd/lib.rs')
-rw-r--r--src/libstd/lib.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 928a1088d0e..586f513835b 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -126,6 +126,7 @@
 #[cfg(test)] #[phase(plugin, link)] extern crate log;
 
 extern crate alloc;
+extern crate unicode;
 extern crate core;
 extern crate core_collections = "collections";
 extern crate core_rand = "rand";
@@ -148,7 +149,6 @@ extern crate rustrt;
 pub use core::any;
 pub use core::bool;
 pub use core::cell;
-pub use core::char;
 pub use core::clone;
 #[cfg(not(test))] pub use core::cmp;
 pub use core::default;
@@ -180,6 +180,8 @@ pub use core_collections::vec;
 pub use rustrt::c_str;
 pub use rustrt::local_data;
 
+pub use unicode::char;
+
 pub use core_sync::comm;
 
 // Run tests with libgreen instead of libnative.