diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-10-29 06:03:32 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-11-08 19:42:46 -0500 |
| commit | 1f4faaee401f8681e25afbcf3b6296b6cd2ca55a (patch) | |
| tree | f0dac4e7f58ebab635c4bba59a04fca2833db4a8 /src/libstd | |
| parent | 85c51d3b02e421e2ab99c330e0d8212293f64f04 (diff) | |
| download | rust-1f4faaee401f8681e25afbcf3b6296b6cd2ca55a.tar.gz rust-1f4faaee401f8681e25afbcf3b6296b6cd2ca55a.zip | |
Generalize AST and ty::Generics to accept multiple lifetimes.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/at_vec.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libstd/at_vec.rs b/src/libstd/at_vec.rs index 7d10061e812..90729966c18 100644 --- a/src/libstd/at_vec.rs +++ b/src/libstd/at_vec.rs @@ -12,7 +12,7 @@ use clone::Clone; use container::Container; -use iter::Iterator; +use iter::{Iterator, FromIterator}; use option::{Option, Some, None}; use mem; use unstable::raw::Repr; @@ -134,6 +134,17 @@ impl<T> Clone for @[T] { } } +impl<A> FromIterator<A> for @[A] { + fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> @[A] { + let (lower, _) = iterator.size_hint(); + do build(Some(lower)) |push| { + for x in *iterator { + push(x); + } + } + } +} + #[cfg(not(test))] #[allow(missing_doc)] pub mod traits { |
