about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-12-30 21:01:36 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2014-12-30 21:01:36 +1100
commitb7832ed0b42a2d6512e3f8d09605986237f02ed5 (patch)
tree313e9f72ae737775db85764279a79122f4d8b458 /src/libcore
parentfea5aa656ff4349f4d3e1fea1447d26986762ae1 (diff)
downloadrust-b7832ed0b42a2d6512e3f8d09605986237f02ed5.tar.gz
rust-b7832ed0b42a2d6512e3f8d09605986237f02ed5.zip
Implement `Clone` for a large number of iterators & other adaptors.
It's useful to be able to save state.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/char.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libcore/char.rs b/src/libcore/char.rs
index 9c12b3f68d3..f0151dda8d7 100644
--- a/src/libcore/char.rs
+++ b/src/libcore/char.rs
@@ -430,11 +430,13 @@ impl Char for char {
 
 /// An iterator over the characters that represent a `char`, as escaped by
 /// Rust's unicode escaping rules.
+#[deriving(Clone)]
 pub struct EscapeUnicode {
     c: char,
     state: EscapeUnicodeState
 }
 
+#[deriving(Clone)]
 enum EscapeUnicodeState {
     Backslash,
     Type,
@@ -486,10 +488,12 @@ impl Iterator<char> for EscapeUnicode {
 
 /// An iterator over the characters that represent a `char`, escaped
 /// for maximum portability.
+#[deriving(Clone)]
 pub struct EscapeDefault {
     state: EscapeDefaultState
 }
 
+#[deriving(Clone)]
 enum EscapeDefaultState {
     Backslash(char),
     Char(char),
@@ -513,4 +517,3 @@ impl Iterator<char> for EscapeDefault {
         }
     }
 }
-