]> git.lizzy.rs Git - rust.git/commitdiff
unicode: fix fallout
authorJorge Aparicio <japaricious@gmail.com>
Fri, 2 Jan 2015 04:19:06 +0000 (23:19 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sat, 3 Jan 2015 14:34:04 +0000 (09:34 -0500)
src/libunicode/lib.rs
src/libunicode/u_str.rs

index d33362ec232952648921833ef015678deb7b2090..eabe044ce3b7178616adb90f2685aabed9d0a975 100644 (file)
@@ -29,6 +29,7 @@
        html_playground_url = "http://play.rust-lang.org/")]
 #![no_std]
 #![feature(globs, macro_rules, slicing_syntax, unboxed_closures)]
+#![feature(associated_types)]
 
 extern crate core;
 
index e17bf025cba7cd7e0b5f258fedef0b65f6ae74a9..8ec90acb711f08f1ccef6019b3db39ddb192ee59 100644 (file)
@@ -105,7 +105,9 @@ pub struct GraphemeIndices<'a> {
     iter: Graphemes<'a>,
 }
 
-impl<'a> Iterator<(uint, &'a str)> for GraphemeIndices<'a> {
+impl<'a> Iterator for GraphemeIndices<'a> {
+    type Item = (uint, &'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))
@@ -117,7 +119,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
     }
 }
 
-impl<'a> DoubleEndedIterator<(uint, &'a str)> for GraphemeIndices<'a> {
+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))
@@ -145,7 +147,9 @@ enum GraphemeState {
     Regional,
 }
 
-impl<'a> Iterator<&'a str> for Graphemes<'a> {
+impl<'a> Iterator for Graphemes<'a> {
+    type Item = &'a str;
+
     #[inline]
     fn size_hint(&self) -> (uint, Option<uint>) {
         let slen = self.string.len();
@@ -251,7 +255,7 @@ fn next(&mut self) -> Option<&'a str> {
     }
 }
 
-impl<'a> DoubleEndedIterator<&'a str> for Graphemes<'a> {
+impl<'a> DoubleEndedIterator for Graphemes<'a> {
     #[inline]
     fn next_back(&mut self) -> Option<&'a str> {
         use tables::grapheme as gr;
@@ -428,7 +432,9 @@ pub fn to_char_lossy(&self) -> char {
     }
 }
 
-impl<'a> Iterator<Utf16Item> for Utf16Items<'a> {
+impl<'a> Iterator for Utf16Items<'a> {
+    type Item = Utf16Item;
+
     fn next(&mut self) -> Option<Utf16Item> {
         let u = match self.iter.next() {
             Some(u) => *u,
@@ -505,12 +511,14 @@ pub struct Utf16Encoder<I> {
 
 impl<I> Utf16Encoder<I> {
     /// Create an UTF-16 encoder from any `char` iterator.
-    pub fn new(chars: I) -> Utf16Encoder<I> where I: Iterator<char> {
+    pub fn new(chars: I) -> Utf16Encoder<I> where I: Iterator<Item=char> {
         Utf16Encoder { chars: chars, extra: 0 }
     }
 }
 
-impl<I> Iterator<u16> for Utf16Encoder<I> where I: Iterator<char> {
+impl<I> Iterator for Utf16Encoder<I> where I: Iterator<Item=char> {
+    type Item = u16;
+
     #[inline]
     fn next(&mut self) -> Option<u16> {
         if self.extra != 0 {
@@ -537,9 +545,11 @@ fn size_hint(&self) -> (uint, Option<uint>) {
     }
 }
 
-impl<'a> Iterator<&'a str> for Words<'a> {
+impl<'a> Iterator for Words<'a> {
+    type Item = &'a str;
+
     fn next(&mut self) -> Option<&'a str> { self.inner.next() }
 }
-impl<'a> DoubleEndedIterator<&'a str> for Words<'a> {
+impl<'a> DoubleEndedIterator for Words<'a> {
     fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() }
 }