about summary refs log tree commit diff
path: root/src/libstd/iterator.rs
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-07-27 17:41:30 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-07-27 17:42:10 -0400
commitfe955e7b062f8787f9df7e9c36abc1b83485fead (patch)
tree00e2aedcb998550105a3a401cad284599b3091d5 /src/libstd/iterator.rs
parentffe549daf5b718226490b9e0b677d9876c807f4e (diff)
downloadrust-fe955e7b062f8787f9df7e9c36abc1b83485fead.tar.gz
rust-fe955e7b062f8787f9df7e9c36abc1b83485fead.zip
iterator: add an Extendable trait
Diffstat (limited to 'src/libstd/iterator.rs')
-rw-r--r--src/libstd/iterator.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs
index a6460935a50..2ec8ea41bfb 100644
--- a/src/libstd/iterator.rs
+++ b/src/libstd/iterator.rs
@@ -32,6 +32,12 @@ pub trait FromIterator<A, T: Iterator<A>> {
     fn from_iterator(iterator: &mut T) -> Self;
 }
 
+/// A type growable from an `Iterator` implementation
+pub trait Extendable<A, T: Iterator<A>>: FromIterator<A, T> {
+    /// Extend a container with the elements yielded by an iterator
+    fn extend(&mut self, iterator: &mut T);
+}
+
 /// An interface for dealing with "external iterators". These types of iterators
 /// can be resumed at any time as all state is stored internally as opposed to
 /// being located on the call stack.