about summary refs log tree commit diff
path: root/src/libcollections/str.rs
diff options
context:
space:
mode:
authorSteven Allen <steven@stebalien.com>2016-08-13 14:42:36 -0400
committerSteven Allen <steven@stebalien.com>2016-08-18 12:16:29 -0400
commitde91872a3337dddf9a0d27df7bfb64f3965c81b0 (patch)
tree5204b54ce4d67aa5eb959f741167db6cba2f2454 /src/libcollections/str.rs
parent43c090ed69a624928c03ad61a29a59badf80ff7b (diff)
downloadrust-de91872a3337dddf9a0d27df7bfb64f3965c81b0.tar.gz
rust-de91872a3337dddf9a0d27df7bfb64f3965c81b0.zip
Add a FusedIterator trait.
This trait can be used to avoid the overhead of a fuse wrapper when an iterator
is already well-behaved.

Conforming to: RFC 1581
Closes: #35602
Diffstat (limited to 'src/libcollections/str.rs')
-rw-r--r--src/libcollections/str.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 4c64019de09..999c84ba705 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -23,6 +23,7 @@ use core::str as core_str;
 use core::str::pattern::Pattern;
 use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher};
 use core::mem;
+use core::iter::FusedIterator;
 use rustc_unicode::str::{UnicodeStr, Utf16Encoder};
 
 use vec_deque::VecDeque;
@@ -136,6 +137,9 @@ impl<'a> Iterator for EncodeUtf16<'a> {
     }
 }
 
+#[unstable(feature = "fused", issue = "35602")]
+impl<'a> FusedIterator for EncodeUtf16<'a> {}
+
 // Return the initial codepoint accumulator for the first byte.
 // The first byte is special, only want bottom 5 bits for width 2, 4 bits
 // for width 3, and 3 bits for width 4