]> git.lizzy.rs Git - rust.git/commitdiff
`EscapeUnicode` and `EscapeDefault` are `ExactSizeIterator`s
authorAndrea Canciani <ranma42@gmail.com>
Wed, 30 Dec 2015 09:08:28 +0000 (10:08 +0100)
committerAndrea Canciani <ranma42@gmail.com>
Thu, 26 May 2016 07:59:21 +0000 (09:59 +0200)
In #28662, `size_hint` was made exact for `EscapeUnicode` and
`EscapeDefault`, but neither was marked as `ExactSizeIterator`.

src/libcore/char.rs

index 6a2331dddcf0e80e30260bf6bdac9c24ad8ffc0d..25d90cc6f3a4a37f476684d259bb5e352a0adf1d 100644 (file)
@@ -483,6 +483,9 @@ fn last(self) -> Option<char> {
     }
 }
 
+#[stable(feature = "exact_size_escape", since = "1.11.0")]
+impl ExactSizeIterator for EscapeUnicode { }
+
 /// An iterator that yields the literal escape code of a `char`.
 ///
 /// This `struct` is created by the [`escape_default()`] method on [`char`]. See
@@ -578,6 +581,9 @@ fn last(self) -> Option<char> {
     }
 }
 
+#[stable(feature = "exact_size_escape", since = "1.11.0")]
+impl ExactSizeIterator for EscapeDefault { }
+
 /// An iterator over `u8` entries represending the UTF-8 encoding of a `char`
 /// value.
 ///