diff options
| author | Aaron Turon <aturon@mozilla.com> | 2014-11-02 17:04:32 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2014-11-06 08:03:18 -0800 |
| commit | cfafc1b7377d34d8c60db7cd386836d39b80af41 (patch) | |
| tree | fc5490eb766f91db85f6fa6061a48efd23f0457e /src/libunicode | |
| parent | e84e7a00ddec76570bbaa9afea385d544f616814 (diff) | |
| download | rust-cfafc1b7377d34d8c60db7cd386836d39b80af41.tar.gz rust-cfafc1b7377d34d8c60db7cd386836d39b80af41.zip | |
Prelude: rename and consolidate extension traits
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses. The renamings are consistent with the [new `-Prelude` suffix](https://github.com/rust-lang/rfcs/pull/344). There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules. Because this renames traits, it is a: [breaking-change] However, I do not expect any code that currently uses the standard library to actually break. Closes #17917
Diffstat (limited to 'src/libunicode')
| -rw-r--r-- | src/libunicode/lib.rs | 2 | ||||
| -rw-r--r-- | src/libunicode/normalize.rs | 2 | ||||
| -rw-r--r-- | src/libunicode/tables.rs | 12 | ||||
| -rw-r--r-- | src/libunicode/u_str.rs | 8 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index b84aec77a09..0db0ffd5cb4 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -73,7 +73,7 @@ pub mod char { } pub mod str { - pub use u_str::{UnicodeStrSlice, Words, Graphemes, GraphemeIndices}; + pub use u_str::{UnicodeStrPrelude, Words, Graphemes, GraphemeIndices}; } // this lets us use #[deriving(Clone)] diff --git a/src/libunicode/normalize.rs b/src/libunicode/normalize.rs index 76a9476d1fc..ad36215c11b 100644 --- a/src/libunicode/normalize.rs +++ b/src/libunicode/normalize.rs @@ -16,7 +16,7 @@ use core::cmp::{Equal, Less, Greater}; use core::option::{Option, Some, None}; use core::slice; -use core::slice::ImmutableSlice; +use core::slice::SlicePrelude; use tables::normalization::{canonical_table, compatibility_table, composition_table}; fn bsearch_table<T>(c: char, r: &'static [(char, &'static [T])]) -> Option<&'static [T]> { diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index 87ee3220ee5..212502fd181 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -13,12 +13,12 @@ #![allow(missing_doc, non_uppercase_statics, non_snake_case)] /// The version of [Unicode](http://www.unicode.org/) -/// that the `UnicodeChar` and `UnicodeStrSlice` traits are based on. +/// that the `UnicodeChar` and `UnicodeStrPrelude` traits are based on. pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0); fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { use core::cmp::{Equal, Less, Greater}; - use core::slice::ImmutableSlice; + use core::slice::SlicePrelude; r.binary_search(|&(lo,hi)| { if lo <= c && c <= hi { Equal } else if hi < c { Less } @@ -6242,7 +6242,7 @@ pub mod normalization { fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 { use core::cmp::{Equal, Less, Greater}; - use core::slice::ImmutableSlice; + use core::slice::SlicePrelude; use core::slice; match r.binary_search(|&(lo, hi, _)| { if lo <= c && c <= hi { Equal } @@ -6367,7 +6367,7 @@ pub mod normalization { pub mod conversions { use core::cmp::{Equal, Less, Greater}; - use core::slice::ImmutableSlice; + use core::slice::SlicePrelude; use core::tuple::Tuple2; use core::option::{Option, Some, None}; use core::slice; @@ -6935,7 +6935,7 @@ pub mod conversions { pub mod charwidth { use core::option::{Option, Some, None}; - use core::slice::ImmutableSlice; + use core::slice::SlicePrelude; use core::slice; fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 { @@ -7134,7 +7134,7 @@ pub mod charwidth { } pub mod grapheme { - use core::slice::ImmutableSlice; + use core::slice::SlicePrelude; use core::slice; #[allow(non_camel_case_types)] diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 9e3830c1f60..50f257c9c85 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -18,11 +18,11 @@ */ use core::cmp; -use core::slice::ImmutableSlice; +use core::slice::SlicePrelude; use core::iter::{Filter, AdditiveIterator, Iterator, DoubleEndedIterator}; use core::kinds::Sized; use core::option::{Option, None, Some}; -use core::str::{CharSplits, StrSlice}; +use core::str::{CharSplits, StrPrelude}; use u_char; use u_char::UnicodeChar; use tables::grapheme::GraphemeCat; @@ -32,7 +32,7 @@ pub type Words<'a> = Filter<'a, &'a str, CharSplits<'a, extern "Rust" fn(char) -> bool>>; /// Methods for Unicode string slices -pub trait UnicodeStrSlice for Sized? { +pub trait UnicodeStrPrelude for Sized? { /// Returns an iterator over the /// [grapheme clusters](http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) /// of the string. @@ -129,7 +129,7 @@ pub trait UnicodeStrSlice for Sized? { fn trim_right<'a>(&'a self) -> &'a str; } -impl UnicodeStrSlice for str { +impl UnicodeStrPrelude for str { #[inline] fn graphemes(&self, is_extended: bool) -> Graphemes { Graphemes { string: self, extended: is_extended, cat: None, catb: None } |
