From b7832ed0b42a2d6512e3f8d09605986237f02ed5 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Tue, 30 Dec 2014 21:01:36 +1100 Subject: Implement `Clone` for a large number of iterators & other adaptors. It's useful to be able to save state. --- src/libstd/io/fs.rs | 1 + src/libstd/io/util.rs | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src/libstd/io') diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index f2db2875ebf..5b5c1fbcec7 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -558,6 +558,7 @@ pub fn walk_dir(path: &Path) -> IoResult { } /// An iterator that walks over a directory +#[deriving(Clone)] pub struct Directories { stack: Vec, } diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 43893ca0126..3624f14e440 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -163,6 +163,7 @@ impl Writer for MultiWriter { /// A `Reader` which chains input from multiple `Reader`s, reading each to /// completion before moving onto the next. +#[deriving(Clone)] pub struct ChainedReader { readers: I, cur_reader: Option, @@ -246,6 +247,7 @@ pub fn copy(r: &mut R, w: &mut W) -> io::IoResult<()> { } /// An adaptor converting an `Iterator` to a `Reader`. +#[deriving(Clone)] pub struct IterReader { iter: T, } -- cgit 1.4.1-3-g733a5