about summary refs log tree commit diff
path: root/src/libcore/iter.rs
AgeCommit message (Collapse)AuthorLines
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
2015-04-01Simplify `match` branches in iter.rs exampleCorey Farwell-4/+2
2015-03-31Test fixes and rebase conflicts, round 3Alex Crichton-1/+2
2015-03-31rollup merge of #23899: steveklabnik/gh23851Alex Crichton-9/+12
Conflicts: src/libcore/iter.rs
2015-03-31rollup merge of #23288: alexcrichton/issue-19470Alex Crichton-6/+5
This is a deprecated attribute that is slated for removal, and it also affects all implementors of the trait. This commit removes the attribute and fixes up implementors accordingly. The primary implementation which was lost was the ability to compare `&[T]` and `Vec<T>` (in that order). This change also modifies the `assert_eq!` macro to not consider both directions of equality, only the one given in the left/right forms to the macro. This modification is motivated due to the fact that `&[T] == Vec<T>` no longer compiles, causing hundreds of errors in unit tests in the standard library (and likely throughout the community as well). Closes #19470 [breaking-change]
2015-03-31rollup merge of #23908: aturon/stab-more-stragglersAlex Crichton-3/+2
* The `io::Seek` trait. * The `Iterator::{partition, unsip}` methods. * The `Vec::into_boxed_slice` method. * The `LinkedList::append` method. * The `{or_insert, or_insert_with` methods in the `Entry` APIs. r? @alexcrichton
2015-03-31Test fixes and rebase conflicts, round 2Alex Crichton-51/+71
2015-03-31rollup merge of #23873: alexcrichton/remove-deprecatedAlex Crichton-153/+13
Conflicts: src/libcollectionstest/fmt.rs src/libcollectionstest/lib.rs src/libcollectionstest/str.rs src/libcore/error.rs src/libstd/fs.rs src/libstd/io/cursor.rs src/libstd/os.rs src/libstd/process.rs src/libtest/lib.rs src/test/run-pass-fulldeps/compiler-calls.rs
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-153/+13
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-31rollup merge of #23886: demelev/remove_as_slice_usageAlex Crichton-4/+4
2015-03-31rollup merge of #23878: Ryman/stable_extremesAlex Crichton-23/+35
`min`-like functions now return the leftmost element/input for equal elements. `max`-like return the rightmost. Closes #23687. cc @HeroesGrave, @aturon, @alexcrichton
2015-03-31Stabilize a few remaining stragglersAaron Turon-3/+2
* The `io::Seek` trait, and `SeekFrom` enum. * The `Iterator::{partition, unsip}` methods. * The `Vec::into_boxed_slice` method. * The `LinkedList::append` method. * The `{or_insert, or_insert_with` methods in the `Entry` APIs.
2015-03-31std: Remove #[old_orphan_check] from PartialEqAlex Crichton-6/+5
This is a deprecated attribute that is slated for removal, and it also affects all implementors of the trait. This commit removes the attribute and fixes up implementors accordingly. The primary implementation which was lost was the ability to compare `&[T]` and `Vec<T>` (in that order). This change also modifies the `assert_eq!` macro to not consider both directions of equality, only the one given in the left/right forms to the macro. This modification is motivated due to the fact that `&[T] == Vec<T>` no longer compiles, causing hundreds of errors in unit tests in the standard library (and likely throughout the community as well). cc #19470 [breaking-change]
2015-03-31Fix up iterator documentation with regards to for loop sugarSteve Klabnik-7/+10
Fixes #23851
2015-03-31Stabilize std::numAaron Turon-36/+122
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-30libcore: Ensure min and max functions are consistent for equal inputsKevin Butler-23/+35
2015-03-31replace deprecated as_slice()Emeliov Dmitrii-4/+4
2015-03-29Add an example for FromIterator::from_iterCorey Farwell-0/+21
2015-03-28Remove IteratorExtSteven Fackler-89/+94
All methods are inlined into Iterator with `Self: Sized` bounds to make sure Iterator is still object safe. [breaking-change]
2015-03-27Note that zip and enumerate are similarSteve Klabnik-0/+17
Fixes #22716
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-2/+20
2015-03-17std: Stabilize `IteratorExt::cloned`Alex Crichton-27/+18
This commit stabilizes the `cloned` iterator after tweaking the signature to require that the iterator is over `&T` instead of `U: Deref<T>`. This method has had time to bake for awhile now and it's not clear whether the `Deref` bound is worth it. Additionally, there aren't clear conventions on when to bound and/or implement the `Deref` trait, so for now the conservative route is to require references instead of `U: Deref<T>`. To change this signature to using `Deref` would technically be a backwards-incompatible change, but it is doubtful that any code will actually break in practice.
2015-03-13Deprecate range, range_step, count, distributionsAaron Turon-69/+113
This commit deprecates the `count`, `range` and `range_step` functions in `iter`, in favor of range notation. To recover all existing functionality, a new `step_by` adapter is provided directly on `ops::Range` and `ops::RangeFrom`. [breaking-change]
2015-03-12Rollup merge of #23247 - tbu-:pr_core_iter_rm_isize, r=huonwManish Goregaokar-3/+3
2015-03-11Example -> ExamplesSteve Klabnik-1/+1
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-10Purge `isize` from `core::iter`Tobias Bucher-3/+3
2015-03-08Add description of fold function arguments.Ɓukasz Niemier-1/+1
2015-03-06Rollup merge of #23025 - huonw:better-iter-infer, r=GankroManish Goregaokar-46/+48
This concretely improves type inference of some cases (see included test). I assume the compiler struggles to reason about multiple layers of generic type parameters (even with associated-type equalities) but *can* understand pure associated types, since they are always directly computable from the input types. Thanks to @shepmaster for noticing the issue with `Cloned` (I took that example as a test case).
2015-03-05Use more associated types in core::iter.Huon Wilson-46/+48
This concretely improves type inference of some cases (see included test). I assume the compiler struggles to reason about multiple layers of generic type parameters (even with associated-type equalities) but *can* understand pure associated types, since they are always directly computable from the input types.