about summary refs log tree commit diff
path: root/src/libcore/iter.rs
AgeCommit message (Collapse)AuthorLines
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-9/+9
2015-06-17core: Split apart the global `core` featureAlex Crichton-34/+39
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-11Auto merge of #26190 - Veedrac:no-iter, r=alexcrichtonbors-6/+6
Pull request for #26188.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-6/+6
2015-06-10core: impl Clone for option::IntoIter and iter::OnceUlrik Sverdrup-0/+1
2015-06-06Remove many unneeded feature annotations in the docsSteve Klabnik-11/+2
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-05-29Implement RFC 771: std::iter::onceNathaniel Theis-0/+94
2015-05-25Auto merge of #25698 - mdinger:flat_map, r=steveklabnikbors-10/+9
I'm not sure why `core` is on but it's blocking the playpen. Doesn't seem to be needed but I'm not sure. It's not on the playpen template and playpen works on release and nightly. Seems easier to understand without `take()`.
2015-05-25Auto merge of #25756 - tshepang:needless-cloned, r=steveklabnikbors-1/+1
2015-05-25doc: add example for Iterator::cloned()Tshepang Lekhonkhobe-2/+13
2015-05-24doc: cloned() and mut not neededTshepang Lekhonkhobe-1/+1
2015-05-22Simplify flat_map examplemdinger-10/+9
2015-05-19Rollup merge of #25591 - rick68:patch-2, r=alexcrichtonManish Goregaokar-1/+1
fixed a mistake.
2015-05-19Update iter.rsWei-Ming Yang-1/+1
fixed a mistake.
2015-05-16std: Fix missing stability on iter::ClonedAlex Crichton-1/+1
The method was stabilized but the structure was forgotten to be stabilized. Closes #25480
2015-05-10doc: unwrap is discouraged, so use SomeTshepang Lekhonkhobe-34/+34
2015-05-09Convert #[lang="..."] to #[lang = "..."]Nick Hamann-1/+1
In my opinion this looks nicer, but also it matches the whitespace generally used for stability markers more closely.
2015-05-08doc: the prevailing convention is to use assert_eq! when 2 values are comparedTshepang Lekhonkhobe-15/+15
2015-05-07Rollup merge of #25144 - killercup:docs/iter-fold-reduce, r=steveklabnikSteve Klabnik-0/+2
Enhance Google-ability of `.fold()` by mentioning 'reduce' and 'inject' in the docs. Motivation: [This thread on users.rust-lang.org](https://users.rust-lang.org/t/find-the-shortest-string-in-a-vector/1247)
2015-05-06Make overflow behaviour more obvious in the iterator module of `libcore`Tobias Bucher-6/+58
Explicitely spell out behaviour on overflow for `usize`-returning iterator functions. Mention that panics are guaranteed if debug assertions are active, otherwise a wrong result might be returned.
2015-05-06Iter Docs: Mention 'reduce' and 'inject'Pascal Hertleif-0/+2
2015-05-05Optimize iterator adapters.Steven Allen-18/+145
Specifically, make count, nth, and last call the corresponding methods on the underlying iterator where possible. This way, if the underlying iterator has an optimized count, nth, or last implementations (e.g. slice::Iter), these methods will propagate these optimizations. Additionally, change Skip::next to take advantage of a potentially optimized nth method on the underlying iterator.
2015-05-01Auto merge of #25006 - alexcrichton:unstable-indexing, r=aturonbors-9/+4
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791 [breaking-change]
2015-05-01std: Remove index notation on slice iteratorsAlex Crichton-9/+4
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791
2015-05-01iterator: Add `StepBy::size_hint` methodcritiqjo-15/+41
Fixes `Step::steps_between` implementations by integer types to correctly handle `by != 1`.
2015-04-29Auto merge of #24865 - bluss:range-size, r=alexcrichtonbors-4/+35
core: Fix size_hint for signed integer `Range<T>` iterators There was an overflow bug in .size_hint() for signed iterators, which produced an hilariously incorrect size or an overflow panic. Incorrect size is a serious bug since the iterators are marked ExactSizeIterator. (And leads to abort() on (-1i8..127).collect() when the collection tries to preallocate too much). > (-1i8..127).size_hint() (18446744073709551488, Some(18446744073709551488)) Bug found using quickcheck. Fixes #24851
2015-04-27core: Fix size_hint for signed integer Range<T> iteratorsUlrik Sverdrup-4/+35
There was an overflow bug in .size_hint() for signed iterators, which produced an hilariously incorrect size or an overflow panic. Incorrect size is a serious bug since the iterators are marked ExactSizeIterator. (And leads to abort() on (-1i8..127).collect() when the collection tries to preallocate too much). All signed range iterators were affected. > (-1i8..127).size_hint() (18446744073709551488, Some(18446744073709551488)) Bug found using quickcheck. Fixes #24851
2015-04-26Indicate function call is code-like in doc-commentCorey Farwell-2/+2
2015-04-21std: Bring back f32::from_str_radix as an unstable APIAlex Crichton-2/+1
This API was exercised in a few tests and mirrors the `from_str_radix` functionality of the integer types.
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-75/+1
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-18Indicate keywords are code-like in Fuse::reset_fuse doc commentCorey Farwell-2/+3
2015-04-16Indicate None is code-like in doc commentsCorey Farwell-5/+5
2015-04-15Rollup merge of #24465 - steveklabnik:intoiteratordocfix, r=alexcrichtonSteve Klabnik-1/+1
2015-04-15Rollup merge of #24440 - nham:improve_enumerate_doc, r=alexcrichtonSteve Klabnik-2/+3
I found that the current description of `enumerate()` doesn't actually tell you what, specifically, the method does, and you have to look at the example to figure it out. Here's a description that I think is better.
2015-04-15Describe the Iterator enumerate() method more clearly.Nick Hamann-2/+3
2015-04-15Fix link in intoiterator docsSteve Klabnik-1/+1
2015-04-14rollup merge of #24377: apasel422/docsAlex Crichton-24/+24
Conflicts: src/libstd/net/ip.rs src/libstd/sys/unix/fs.rs src/libstd/sys/unix/mod.rs src/libstd/sys/windows/mod.rs
2015-04-14RebasedNick Cameron-1/+1
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-24/+24
2015-04-11Simplify iterator logic for FuseCorey Farwell-14/+6
2015-04-10Auto merge of #24180 - huonw:optimise-max-etc, r=alexcrichtonbors-36/+57
The main change in this patch is removing the use of `Option` inside the inner loops of those functions to avoid comparisons where one branch will only trigger on the first pass through the loop. The included benchmarks go from: test bench_max ... bench: 372 ns/iter (+/- 118) test bench_max_by ... bench: 428 ns/iter (+/- 33) test bench_max_by2 ... bench: 7128 ns/iter (+/- 326) to: test bench_max ... bench: 317 ns/iter (+/- 64) test bench_max_by ... bench: 356 ns/iter (+/- 270) test bench_max_by2 ... bench: 1387 ns/iter (+/- 183) Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-10Optimise Iterator::{max, max_by, min, min_by}.Huon Wilson-36/+57
The main change in this patch is removing the use of `Option` inside the inner loops of those functions to avoid comparisons where one branch will only trigger on the first pass through the loop. The included benchmarks go from: test bench_max ... bench: 372 ns/iter (+/- 118) test bench_max_by ... bench: 428 ns/iter (+/- 33) test bench_max_by2 ... bench: 7128 ns/iter (+/- 326) to: test bench_max ... bench: 317 ns/iter (+/- 64) test bench_max_by ... bench: 356 ns/iter (+/- 270) test bench_max_by2 ... bench: 1387 ns/iter (+/- 183) Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-09Improve bounds in Iterator APIAaron Turon-20/+22
This commit changes `Iterator`'s API by: * Generalizing bounds from `Iterator` to `IntoIterator` whenever possible, matching the semantics and ergonomics of `for` loops. * Tightens up a few method-level bounds so that you get an error earlier. For example, `rev` did not require `DoubleEndedIterator` even though the result is only an `Iterator` when the original iterator was double-ended. Closes #23587 The bound-tightening is technically a: [breaking-change] but no code should break in practice.
2015-04-08Auto merge of #24120 - aturon:range-perf, r=alexcrichtonbors-24/+23
A recent change to the implementation of range iterators meant that, even when stepping by 1, the iterators *always* involved checked arithmetic. This commit reverts to the earlier behavior (while retaining the refactoring into traits). Fixes #24095 Closes #24119 cc #24014 r? @alexcrichton
2015-04-07Fix range performance regressionAaron Turon-24/+23
A recent change to the implementation of range iterators meant that, even when stepping by 1, the iterators *always* involved checked arithmetic. This commit reverts to the earlier behavior (while retaining the refactoring into traits). Fixes #24095 cc #24014
2015-04-08Make `sum` and `product` inherent methods on `Iterator`Tobias Bucher-153/+48
In addition to being nicer, this also allows you to use `sum` and `product` for iterators yielding custom types aside from the standard integers. Due to removing the `AdditiveIterator` and `MultiplicativeIterator` trait, this is a breaking change. [breaking-change]
2015-04-06Make `AdditiveIterator` and `MultiplicativeIterator` extensibleTobias Bucher-37/+93
Previously it could not be implemented for types outside `libcore/iter.rs` due to coherence issues.
2015-04-04Auto merge of #24045 - frewsxcv:cleanup, r=alexcrichtonbors-90/+62
2015-04-03Cleanup and modernize some things in libcore::iterCorey Farwell-90/+62
2015-04-02Indicate associated type in comment is code-likeCorey Farwell-1/+1