about summary refs log tree commit diff
path: root/src/libcore/iter.rs
AgeCommit message (Collapse)AuthorLines
2015-01-02rollup merge of #20341: nikomatsakis/impl-trait-for-trait-2Alex Crichton-3/+4
Conflicts: src/librustc/middle/traits/mod.rs src/libstd/io/mod.rs src/test/run-pass/builtin-superkinds-self-type.rs
2015-01-02rollup merge of #20386: frewsxcv/rm-reexportsAlex Crichton-3/+3
Part of #19253 [breaking-change]
2015-01-02core: use assoc types in `Deref[Mut]`Jorge Aparicio-4/+4
2015-01-02Fix fallout from change, adding explicit `Sized` annotations where necessary.Niko Matsakis-3/+4
2015-01-02Fallout - change array syntax to use `;`Nick Cameron-1/+1
2014-12-31Remove core::iter::MinMaxResult::* public reexportCorey Farwell-3/+3
Part of #19253 [breaking-change]
2014-12-30Fallout from stabilizationAaron Turon-1/+1
2014-12-30Adjustments from reviewAaron Turon-3/+7
2014-12-30std::iter: Add partition and unzip methods to iteratorsAaron Turon-15/+76
2014-12-24Review changesNick Cameron-0/+58
2014-12-22Insert coercions to fn pointer types required for the new typesNiko Matsakis-0/+3
post-unboxed-closure-conversion. This requires a fair amount of annoying coercions because all the `map` etc types are defined generically over the `F`, so the automatic coercions don't propagate; this is compounded by the need to use `let` and not `as` due to stage0. That said, this pattern is to a large extent temporary and unusual.
2014-12-20Stabilize cloneAaron Turon-0/+9
This patch marks `clone` stable, as well as the `Clone` trait, but leaves `clone_from` unstable. The latter will be decided by the beta. The patch also marks most manual implementations of `Clone` as stable, except where the APIs are otherwise deprecated or where there is uncertainty about providing `Clone`.
2014-12-19libcore: use `#[deriving(Copy)]`Jorge Aparicio-12/+4
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-25/+25
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-17rollup merge of #19873: drewm1980/masterAlex Crichton-26/+26
In US english, "that" is used in restrictive clauses in place of "which", and often affects the meaning of sentences. In UK english and many dialects, no distinction is made. While Rust devs want to avoid unproductive pedanticism, it is worth at least being uniform in documentation such as: http://doc.rust-lang.org/std/iter/index.html and also in cases where correct usage of US english clarifies the sentence.
2014-12-17rollup merge of #19827: japaric/clone-ucAlex Crichton-0/+124
closes #12677 (cc @Valloric) cc #15294 r? @aturon / @alexcrichton (Because of #19358 I had to move the struct bounds from the `where` clause into the parameter list)
2014-12-15Standardize some usages of "which" in docstringsAndrew Wagner-26/+26
In US english, "that" is used in restrictive clauses in place of "which", and often affects the meaning of sentences. In UK english and many dialects, no distinction is made. While Rust devs want to avoid unproductive pedanticism, it is worth at least being uniform in documentation such as: http://doc.rust-lang.org/std/iter/index.html and also in cases where correct usage of US english clarifies the sentence.
2014-12-14libcore: make iterator adaptors `Clone`ableJorge Aparicio-0/+124
2014-12-13libcore: fix move semantics falloutJorge Aparicio-1/+1
2014-12-13libcore: use unboxed closures in `ExactSizeIterator` methodsJorge Aparicio-1/+1
2014-12-13libcore: use unboxed closures in `IteratorExt` methodsJorge Aparicio-7/+7
2014-12-13libcore: use unboxed closures in the fields of `Unfold`Jorge Aparicio-11/+18
2014-12-13libcore: use unboxed closures in the fields of `Inspect`Jorge Aparicio-11/+18
2014-12-13libcore: use unboxed closures in the fields of `FlatMap`Jorge Aparicio-10/+17
2014-12-13libcore: use unboxed closures in the fields of `Scan`Jorge Aparicio-6/+10
2014-12-13libcore: use unboxed closures in the fields of `TakeWhile`Jorge Aparicio-5/+5
2014-12-13libcore: use unboxed closures in the fields of `SkipWhile`Jorge Aparicio-5/+5
2014-12-13libcore: use unboxed closures in the fields of `FilterMap`Jorge Aparicio-7/+12
2014-12-13libcore: use unboxed closures in the fields of `Filter`Jorge Aparicio-6/+9
2014-12-13libcore: use unboxed closures in the fields of `Map`Jorge Aparicio-10/+19
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-2/+9
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-05Utilize fewer reexportsCorey Farwell-10/+13
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05rollup merge of #19512: cybergeek94/masterCorey Richardson-3/+34
Added the example from [this Reddit thread][1], reworked to be more robust with correct logic (first link skipped the 0th and 1st Fibonacci numbers, second forgot about the last two valid values before overflow). Will yield all Fibonacci numbers sequentially in the range `[0, <u32 as Int>::max_value())`. If the example is too complicated I can change it to a more naive version, perhaps using signed integers to check for overflow instead of `Option` and `.checked_add()`. Also reworded the doc comments to clarify the usage and behavior of `Unfold`, as the thread suggested that it wasn't really clear how `Unfold` worked and when one should use it. This change is in the `core` crate but I based the example on `std` since that's where most readers will find the example. I included a note about `core` for clarity. Edit: removed. Tested with `rustdoc src/libcore/lib.rs`. Rebased against latest master as of the creation of this PR. [1]: http://www.reddit.com/r/rust/comments/2ny8r1/a_question_about_loops/cmighu4?context=10000
2014-12-04core::iter::Unfold: reword docs and add exampleAustin Bonander-3/+34
Remove note about core
2014-12-03Overload the `==` operatorJorge Aparicio-2/+10
- String == &str == CowString - Vec == &[T] == &mut [T] == [T, ..N] == CowVec - InternedString == &str
2014-11-26/*! -> //!Steve Klabnik-49/+45
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-25libs: stabilize iter moduleAaron Turon-44/+199
This is an initial pass at stabilizing the `iter` module. The module is fairly large, but is also pretty polished, so most of the stabilization leaves things as they are. Some changes: * Due to the new object safety rules, various traits needs to be split into object-safe traits and extension traits. This includes `Iterator` itself. While splitting up the traits adds some complexity, it will also increase flexbility: once we have automatic impls of `Trait` for trait objects over `Trait`, then things like the iterator adapters will all work with trait objects. * Iterator adapters that use up the entire iterator now take it by value, which makes the semantics more clear and helps catch bugs. Due to the splitting of Iterator, this does not affect trait objects. If the underlying iterator is still desired for some reason, `by_ref` can be used. (Note: this change had no fallout in the Rust distro except for the useless mut lint.) * In general, extension traits new and old are following an [in-progress convention](https://github.com/rust-lang/rfcs/pull/445). As such, they are marked `unstable`. * As usual, anything involving closures is `unstable` pending unboxed closures. * A few of the more esoteric/underdeveloped iterator forms (like `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with various unfolds) are left experimental for now. * The `order` submodule is left `experimental` because it will hopefully be replaced by generalized comparison traits. * "Leaf" iterators (like `Repeat` and `Counter`) are uniformly constructed by free fns at the module level. That's because the types are not otherwise of any significance (if we had `impl Trait`, you wouldn't want to define a type at all). Closes #17701 Due to renamings and splitting of traits, this is a: [breaking-change]
2014-11-21Mention that find() doesn't consume the full iteratorManish Goregaokar-1/+3
2014-11-18add Cloned iterator adaptorAlexis Beingessner-1/+40
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+2
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-14Revert the need for initial values with arithmetic iteratorsBrendan Zabarauskas-18/+50
2014-11-13Remove Signed trait and add SignedInt traitBrendan Zabarauskas-0/+4
The methods have been moved into Float and SignedInt
2014-11-13Deprecate Zero and One traitsBrendan Zabarauskas-30/+39
2014-11-13Move checked arithmetic operators into Int traitBrendan Zabarauskas-18/+16
2014-11-13Move saturating operator methods into IntBrendan Zabarauskas-1/+1
2014-11-08Renamed Extendable to Extendgamazeps-2/+3
In order to upgrade, simply rename the Extendable trait to Extend in your code Part of #18424 [breaking-change]
2014-10-30Add a `repeat` function to the preludeJakub Bukaj-1/+6
Implements a part of RFC 235. [breaking-change]
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-21/+0
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-14Fix the formatting of the documentation for OrdIterator.min_max.Ms2ger-1/+1
2014-09-25Fix Iterator::fuse exampleSteven Fackler-1/+3
The for loop would *always* exaust the iterator previously, which seems like behavior that was not intended. It's still kind of a weird function.