about summary refs log tree commit diff
path: root/src/libstd/iterator.rs
AgeCommit message (Collapse)AuthorLines
2013-07-30std: Implement RandomAccessIterator for iterator adaptorsblake2-ppc-18/+142
Implement RAI where possible for iterator adaptors such as Map, Enumerate, Skip, Take, Zip, Cycle (all of the requiring that the adapted iterator also implements RAI).
2013-07-30iterator: implement size_hint() for FlatMapblake2-ppc-0/+10
2013-07-30iterator: implement DoubleEndedIterator for FlatMapblake2-ppc-5/+44
2013-07-29std: Rename Iterator adaptor types to drop the -Iterator suffixblake2-ppc-89/+89
Drop the "Iterator" suffix for the the structs in std::iterator. Filter, Zip, Chain etc. are shorter type names for when iterator pipelines need their types written out in full in return value types, so it's easier to read and write. the iterator module already forms enough namespace.
2013-07-27iterator: add an Extendable traitDaniel Micay-0/+6
2013-07-27Remove dummy type parameters from iterator adaptorsblake2-ppc-47/+39
With the recent fixes to method resolution, we can now remove the dummy type parameters used as crutches in the iterator module. For example, the zip adaptor type is just ZipIterator<T, U> now.
2013-07-27make RandomAccessIterator inherit from IteratorDaniel Micay-2/+4
2013-07-25auto merge of #8030 : thestinger/rust/iterator, r=huonwbors-2/+0
2013-07-25auto merge of #8015 : msullivan/rust/default-methods, r=nikomatsakisbors-1/+18
Lots of changes to vtable resolution, handling of super/self method calls in default methods. Fix a lot of trait inheritance bugs. r? @nikomatsakis
2013-07-24rm default method lintDaniel Micay-2/+0
default methods are enabled by default, so there's not much point in keeping around a lint to report them as being experimental
2013-07-24Change 'print(fmt!(...))' to printf!/printfln! in src/lib*Birunthan Mohanathas-1/+1
2013-07-24add a RandomAccessIterator traitDaniel Micay-0/+53
2013-07-23Fix some impls such that all supertraits are actually implemented.Michael Sullivan-1/+1
2013-07-23Add a to_owned_vec method to IteratorUtil.Michael Sullivan-0/+17
2013-07-20iterator: Add test for .cycle()blake2-ppc-0/+14
2013-07-20iterator: Let closure-less iterators derive Cloneblake2-ppc-0/+8
2013-07-20iterator: Add .cycle() to repeat an iteratorblake2-ppc-0/+49
2013-07-19iterator: impl DoubleEndedIterator for adaptorsDaniel Micay-0/+121
2013-07-11Take default methods out from behind the flag.Michael Sullivan-1/+1
2013-07-11iterator: add DoubleEndedIterator conceptDaniel Micay-0/+52
This implements the trait for vector iterators, replacing the reverse iterator types. The methods will stay, for implementing the future reverse Iterable traits and convenience. This can also be trivially implemented for circular buffers and other variants of arrays like strings and `SmallIntMap`/`SmallIntSet`. The `DoubleEndedIterator` trait will allow for implementing algorithms like in-place reverse on generic mutable iterators. The naming (`Range` vs. `Iterator`, `Bidirectional` vs. `DoubleEnded`) can be bikeshedded in the future.
2013-07-08auto merge of #7604 : apasel422/rust/peek, r=huonwbors-0/+65
This can be useful for inserting debugging code at different steps in an iterator pipeline.
2013-07-07remove some method resolve workaroundsDaniel Micay-13/+13
2013-07-07iterator: Add `IteratorUtil::peek_` methodAndrew Paseltiner-0/+65
2013-07-05Implement .size_hint() on the remaining Iterator adaptorsKevin Ballard-1/+118
Every iterator adaptor now has an implementation of .size_hint() that makes sense, except for when the default of (0, None) is correct.
2013-07-05Change signature of Iterator.size_hintKevin Ballard-13/+8
Remove the Option wrapper around the lower bound. None is semantically the same as Size(0), so there's no point in having a distinction.
2013-06-30Remove vec::{map, mapi, zip_map} and the methods, except for .map, since thisHuon Wilson-2/+1
is very common, and the replacement (.iter().transform().collect()) is very ugly.
2013-06-29fix code block syntax in two docstringsDaniel Micay-4/+4
2013-06-29'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep ↵Ben Blum-1/+1
for making them noncopyable.
2013-06-29iterator: UnfoldrIterator::new should have function argument lastblake2-ppc-2/+2
To match Rust conventions and enable use of `do` etc, make sure the closure is the last argument to the `new` method.
2013-06-27auto merge of #7430 : huonw/rust/vec-kill, r=thestingerbors-1/+0
2013-06-28std: silence some test warnings.Huon Wilson-1/+0
2013-06-27iterator: Add `IteratorUtil::max_by/min_by` methodgifnksm-0/+62
2013-06-26auto merge of #7345 : blake2-ppc/rust/iterator-flat-map, r=thestingerbors-0/+67
flat_map_ produces an iterator that maps each element to an iterator, and yields the elements of the produced iterators. This is the monadic bind :: M a -> (a -> M b) -> M b for iterators. Named just like the vec method, but with a trailing underline until the method resolution bug is resolved. We discussed the name chain_map, but I decided to go with flat_map_ for consistency with vec. Since it.map(f).flatten() would be the same as it.flat_map(f), we could choose to just implement a flatten method instead. Either way the possibilities are the same but flat_map is more convenient.
2013-06-25Remove stage0 cfgsJames Miller-5/+0
2013-06-24iterator: Add `IteratorUtil::flat_map_` methodblake2-ppc-0/+67
flat_map_ produces an iterator that maps each element to an iterator, and yields the elements of the produced iterators. This is the monadic bind :: M a -> (a -> M b) -> M b for iterators. Named just like the vec method, but with a trailing underline until the method resolution bug is resolved.
2013-06-24iterator: implement `collect` with FromIteratorDaniel Micay-5/+5
This makes it take advantage of the size hint for pre-allocation.
2013-06-22iterator: add a FromIterator traitDaniel Micay-1/+7
This is able to take advantage of the lower bound from the size hint.
2013-06-22iterator: add a size_hint default methodDaniel Micay-0/+49
also adds an implementation for the vector iterators
2013-06-21vec: replace `position` with `iter().position_`Daniel Micay-1/+1
2013-06-21vec: rm old_iter implementations, except BaseIterDaniel Micay-9/+30
The removed test for issue #2611 is well covered by the `std::iterator` module itself. This adds the `count` method to `IteratorUtil` to replace `EqIter`.
2013-06-18replace #[inline(always)] with #[inline]. r=burningtree.Graydon Hoare-24/+24
2013-06-16auto merge of #7177 : huonw/rust/unfold-fix, r=thestingerbors-2/+2
2013-06-16std: fix UnfoldrIterator cross-crate.Huon Wilson-2/+2
2013-06-15iterator: work around method resolve bugDaniel Micay-10/+10
2013-06-15iterator: add a `position` adaptorDaniel Micay-0/+24
2013-06-15iterator: add a `find` adaptorDaniel Micay-3/+23
2013-06-14add IteratorUtil to the preludeDaniel Micay-43/+3
2013-06-12auto merge of #7073 : influenza/rust/iterator-doc-fixes, r=catamorphismbors-3/+3
This commit fixes two typos and an incorrect description.
2013-06-11Iterator documentation fixesRon Dahlgren-3/+3
Fixes two typos and one incorrect description.
2013-06-11option: remove redundant old_iter implsDaniel Micay-20/+22