diff options
Diffstat (limited to 'src/libunicode')
| -rw-r--r-- | src/libunicode/lib.rs | 1 | ||||
| -rw-r--r-- | src/libunicode/tables.rs | 10 | ||||
| -rw-r--r-- | src/libunicode/u_char.rs | 28 | ||||
| -rw-r--r-- | src/libunicode/u_str.rs | 30 |
4 files changed, 34 insertions, 35 deletions
diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 0ac569b9c8e..deffc1fe8da 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -32,7 +32,6 @@ #![feature(no_std)] #![no_std] #![feature(slicing_syntax)] -#![feature(int_uint)] #![feature(core)] extern crate core; diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index a38f911688d..61f447a3dd3 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -14,7 +14,7 @@ /// The version of [Unicode](http://www.unicode.org/) /// that the unicode parts of `CharExt` and `UnicodeStrPrelude` traits are based on. -pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0); +pub const UNICODE_VERSION: (u64, u64, u64) = (7, 0, 0); fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { use core::cmp::Ordering::{Equal, Less, Greater}; @@ -6977,7 +6977,7 @@ pub mod conversions { } } - fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> { + fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<usize> { match table.binary_search_by(|&(key, _)| { if c == key { Equal } else if key < c { Less } @@ -7613,13 +7613,13 @@ pub mod charwidth { } } - pub fn width(c: char, is_cjk: bool) -> Option<uint> { - match c as uint { + pub fn width(c: char, is_cjk: bool) -> Option<usize> { + match c as usize { _c @ 0 => Some(0), // null is zero width cu if cu < 0x20 => None, // control sequences have no width cu if cu < 0x7F => Some(1), // ASCII cu if cu < 0xA0 => None, // more control sequences - _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as uint) + _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as usize) } } diff --git a/src/libunicode/u_char.rs b/src/libunicode/u_char.rs index 467fed5d246..c0f45ca4d72 100644 --- a/src/libunicode/u_char.rs +++ b/src/libunicode/u_char.rs @@ -36,7 +36,7 @@ pub trait CharExt { /// Panics if given a radix > 36. #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn is_digit(self, radix: uint) -> bool; + fn is_digit(self, radix: u32) -> bool; /// Converts a character to the corresponding digit. /// @@ -51,7 +51,7 @@ pub trait CharExt { /// Panics if given a radix outside the range [0..36]. #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn to_digit(self, radix: uint) -> Option<uint>; + fn to_digit(self, radix: u32) -> Option<u32>; /// Returns an iterator that yields the hexadecimal Unicode escape /// of a character, as `char`s. @@ -80,12 +80,12 @@ pub trait CharExt { /// Returns the amount of bytes this character would need if encoded in /// UTF-8. #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> uint; + fn len_utf8(self) -> usize; /// Returns the amount of bytes this character would need if encoded in /// UTF-16. #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> uint; + fn len_utf16(self) -> usize; /// Encodes this character as UTF-8 into the provided byte buffer, /// and then returns the number of bytes written. @@ -94,7 +94,7 @@ pub trait CharExt { /// and a `None` will be returned. #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf8(self, dst: &mut [u8]) -> Option<uint>; + fn encode_utf8(self, dst: &mut [u8]) -> Option<usize>; /// Encodes this character as UTF-16 into the provided `u16` buffer, /// and then returns the number of `u16`s written. @@ -103,7 +103,7 @@ pub trait CharExt { /// and a `None` will be returned. #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf16(self, dst: &mut [u16]) -> Option<uint>; + fn encode_utf16(self, dst: &mut [u16]) -> Option<usize>; /// Returns whether the specified character is considered a Unicode /// alphabetic code point. @@ -216,31 +216,31 @@ pub trait CharExt { /// `is_cjk` = `false`) if the context cannot be reliably determined. #[unstable(feature = "unicode", reason = "needs expert opinion. is_cjk flag stands out as ugly")] - fn width(self, is_cjk: bool) -> Option<uint>; + fn width(self, is_cjk: bool) -> Option<usize>; } #[stable(feature = "rust1", since = "1.0.0")] impl CharExt for char { #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn is_digit(self, radix: uint) -> bool { C::is_digit(self, radix) } + fn is_digit(self, radix: u32) -> bool { C::is_digit(self, radix) } #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn to_digit(self, radix: uint) -> Option<uint> { C::to_digit(self, radix) } + fn to_digit(self, radix: u32) -> Option<u32> { C::to_digit(self, radix) } #[stable(feature = "rust1", since = "1.0.0")] fn escape_unicode(self) -> char::EscapeUnicode { C::escape_unicode(self) } #[stable(feature = "rust1", since = "1.0.0")] fn escape_default(self) -> char::EscapeDefault { C::escape_default(self) } #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> uint { C::len_utf8(self) } + fn len_utf8(self) -> usize { C::len_utf8(self) } #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> uint { C::len_utf16(self) } + fn len_utf16(self) -> usize { C::len_utf16(self) } #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf8(self, dst: &mut [u8]) -> Option<uint> { C::encode_utf8(self, dst) } + fn encode_utf8(self, dst: &mut [u8]) -> Option<usize> { C::encode_utf8(self, dst) } #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf16(self, dst: &mut [u16]) -> Option<uint> { C::encode_utf16(self, dst) } + fn encode_utf16(self, dst: &mut [u16]) -> Option<usize> { C::encode_utf16(self, dst) } #[stable(feature = "rust1", since = "1.0.0")] fn is_alphabetic(self) -> bool { @@ -313,5 +313,5 @@ impl CharExt for char { #[unstable(feature = "unicode", reason = "needs expert opinion. is_cjk flag stands out as ugly")] - fn width(self, is_cjk: bool) -> Option<uint> { charwidth::width(self, is_cjk) } + fn width(self, is_cjk: bool) -> Option<usize> { charwidth::width(self, is_cjk) } } diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 15cf3986e6e..9bd8c5525a0 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -43,7 +43,7 @@ pub trait UnicodeStr { fn words<'a>(&'a self) -> Words<'a>; fn is_whitespace(&self) -> bool; fn is_alphanumeric(&self) -> bool; - fn width(&self, is_cjk: bool) -> uint; + fn width(&self, is_cjk: bool) -> usize; fn trim<'a>(&'a self) -> &'a str; fn trim_left<'a>(&'a self) -> &'a str; fn trim_right<'a>(&'a self) -> &'a str; @@ -57,7 +57,7 @@ impl UnicodeStr for str { #[inline] fn grapheme_indices(&self, is_extended: bool) -> GraphemeIndices { - GraphemeIndices { start_offset: self.as_ptr() as uint, iter: self.graphemes(is_extended) } + GraphemeIndices { start_offset: self.as_ptr() as usize, iter: self.graphemes(is_extended) } } #[inline] @@ -78,7 +78,7 @@ impl UnicodeStr for str { fn is_alphanumeric(&self) -> bool { self.chars().all(|c| c.is_alphanumeric()) } #[inline] - fn width(&self, is_cjk: bool) -> uint { + fn width(&self, is_cjk: bool) -> usize { self.chars().map(|c| c.width(is_cjk).unwrap_or(0)).sum() } @@ -101,28 +101,28 @@ impl UnicodeStr for str { /// External iterator for grapheme clusters and byte offsets. #[derive(Clone)] pub struct GraphemeIndices<'a> { - start_offset: uint, + start_offset: usize, iter: Graphemes<'a>, } impl<'a> Iterator for GraphemeIndices<'a> { - type Item = (uint, &'a str); + type Item = (usize, &'a str); #[inline] - fn next(&mut self) -> Option<(uint, &'a str)> { - self.iter.next().map(|s| (s.as_ptr() as uint - self.start_offset, s)) + fn next(&mut self) -> Option<(usize, &'a str)> { + self.iter.next().map(|s| (s.as_ptr() as usize - self.start_offset, s)) } #[inline] - fn size_hint(&self) -> (uint, Option<uint>) { + fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } } impl<'a> DoubleEndedIterator for GraphemeIndices<'a> { #[inline] - fn next_back(&mut self) -> Option<(uint, &'a str)> { - self.iter.next_back().map(|s| (s.as_ptr() as uint - self.start_offset, s)) + fn next_back(&mut self) -> Option<(usize, &'a str)> { + self.iter.next_back().map(|s| (s.as_ptr() as usize - self.start_offset, s)) } } @@ -151,7 +151,7 @@ impl<'a> Iterator for Graphemes<'a> { type Item = &'a str; #[inline] - fn size_hint(&self) -> (uint, Option<uint>) { + fn size_hint(&self) -> (usize, Option<usize>) { let slen = self.string.len(); (cmp::min(slen, 1), Some(slen)) } @@ -378,8 +378,8 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [ /// Given a first byte, determine how many bytes are in this UTF-8 character #[inline] -pub fn utf8_char_width(b: u8) -> uint { - return UTF8_CHAR_WIDTH[b as uint] as uint; +pub fn utf8_char_width(b: u8) -> usize { + return UTF8_CHAR_WIDTH[b as usize] as usize; } /// Determines if a vector of `u16` contains valid UTF-16 @@ -468,7 +468,7 @@ impl<'a> Iterator for Utf16Items<'a> { } #[inline] - fn size_hint(&self) -> (uint, Option<uint>) { + fn size_hint(&self) -> (usize, Option<usize>) { let (low, high) = self.iter.size_hint(); // we could be entirely valid surrogates (2 elements per // char), or entirely non-surrogates (1 element per char) @@ -534,7 +534,7 @@ impl<I> Iterator for Utf16Encoder<I> where I: Iterator<Item=char> { } #[inline] - fn size_hint(&self) -> (uint, Option<uint>) { + fn size_hint(&self) -> (usize, Option<usize>) { let (low, high) = self.chars.size_hint(); // every char gets either one u16 or two u16, // so this iterator is between 1 or 2 times as |
