about summary refs log tree commit diff
path: root/src/libcore/iter/traits.rs
AgeCommit message (Collapse)AuthorLines
2019-01-22Move core::iter iterator.rs to traits moduleClar Fon-1060/+0
2018-12-25Remove licensesMark Rousskov-9/+0
2018-12-20Add DoubleEndedIterator::nth_backClar Fon-6/+73
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-11-12Document optimizations enabled by FusedIteratorSimon Sapin-1/+1
When reading this I wondered what “some significant optimizations” referred to. As far as I can tell, the specialization of `.fuse()` is the only case where `FusedIterator` has any impact at all. Is this accurate @Stebalien?
2018-09-29Use impl_header_lifetime_elision in libcoreScott McMurray-3/+3
2018-06-19Add message to `rustc_on_unimplemented` attributes in coreEsteban Küber-2/+5
2018-06-13Replace `core::iter::AlwaysOk<T>` by `Result<T, !>`kennytm-2/+2
2018-05-20Auto merge of #50234 - cramertj:extend, r=alexcrichtonbors-0/+7
Add implementation of Extend for () This is useful in some generic code which wants to collect iterators of items into a result.
2018-05-14Add implementation of Extend for ()Taylor Cramer-0/+7
2018-05-14Uncapitalize "You"Matt Kraai-1/+1
2018-04-02Stabilize iterator_try_fold in 1.27.0Josh Stone-3/+1
2018-04-02Stabilize iter_rfind in 1.27.0Josh Stone-6/+2
2018-04-02Stabilize iter_rfold in 1.27.0Josh Stone-3/+1
2018-03-24Fix incorrect lower boundsPhlosioneer-1/+6
2018-03-20Implement some trivial size_hints for various iteratorsPhlosioneer-0/+4
This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708.
2018-03-03core: Update stability attributes for FusedIteratorUlrik Sverdrup-2/+2
2018-03-03core: Stabilize FusedIteratorUlrik Sverdrup-2/+2
FusedIterator is a marker trait that promises that the implementing iterator continues to return `None` from `.next()` once it has returned `None` once (and/or `.next_back()`, if implemented). The effects of FusedIterator are already widely available through `.fuse()`, but with stable `FusedIterator`, stable Rust users can implement this trait for their iterators when appropriate.
2018-02-09Add Range[Inclusive]::is_emptyScott McMurray-1/+1
During the RFC, it was discussed that figuring out whether a range is empty was subtle, and thus there should be a clear and obvious way to do it. It can't just be ExactSizeIterator::is_empty (also unstable) because not all ranges are ExactSize -- not even Range<i32> or RangeInclusive<usize>.
2018-02-04Document TrustedLen guarantees more explicitlyoberien-2/+4
2017-10-29Fundamental internal iteration with try_foldScott McMurray-10/+55
This is the core method in terms of which the other methods (fold, all, any, find, position, nth, ...) can be implemented, allowing Iterator implementors to get the full goodness of internal iteration by only overriding one method (per direction).
2017-09-21Auto merge of #44682 - bluss:iter-rfold, r=dtolnaybors-0/+64
Add iterator method .rfold(init, function); the reverse of fold rfold is the reverse version of fold. Fold allows iterators to implement a different (non-resumable) internal iteration when it is more efficient than the external iteration implemented through the next method. (Common examples are VecDeque and .chain()). Introduce rfold() so that the same customization is available for reverse iteration. This is achieved by both adding the method, and by having the Rev\<I> adaptor connect Rev::rfold → I::fold and Rev::fold → I::rfold. On the surface, rfold(..) is just .rev().fold(..), but the special case implementations allow a data structure specific fold to be used through for example .iter().rev(); we thus have gains even for users never calling exactly rfold themselves.
2017-09-19core: Assign tracking issue for iter_rfoldUlrik Sverdrup-1/+1
2017-09-18core: Add feature gate to rfold example codeUlrik Sverdrup-0/+2
2017-09-18core: Add DoubleEndedIterator::rfoldUlrik Sverdrup-0/+62
rfold is the reverse version of fold. Fold allows iterators to implement a different (non-resumable) internal iteration when it is more efficient than the external iteration implemented through the next method. (Common examples are VecDeque and .chain()). Introduce rfold() so that the same customization is available for reverse iteration. This is achieved by both adding the method, and by having the Rev<I> adaptor connect Rev::rfold -> I::fold, Rev::fold -> I::rfold.
2017-09-18Add Example of `IntoIterator` as Trait Bound to DocsWill Speak-0/+17
Part of #44600.
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-1/+1
Like #43008 (f668999), but _much more aggressive_.
2017-08-11Fix some typosBastien Orivel-1/+1
2017-07-29Rollup merge of #43409 - tshepang:concise, r=steveklabnikMark Simulacrum-25/+8
doc: make into_iter example more concise Also, remove dupe example
2017-07-24doc: make into_iter example more conciseTshepang Lekhonkhobe-25/+8
2017-07-14add u128/i128 to sum/product implementorsZack M. Davis-1/+1
Resolves #43235.
2017-06-12Add dedicated docstrings to Sum/Product impl of ResultGeorg Brandl-1/+21
(and fix a minor grammar typo below)
2017-05-31fix links to "module-level documentation"Raphaël Huchet-2/+2
2017-04-03iter: Simplification in rfind's provided implementationUlrik Sverdrup-1/+1
- Prefer simpler constructs instead of going through &mut I's Iterator implementation.
2017-03-21Fix doc error for ExactSizeIteratorManuel-3/+3
The code example in the trait documentation of ExactSizeIterator has an incorrect implementation of the len method that does not return the number of times the example iterator 'Counter' will iterate. This may confuse readers of the docs as the example code will compile but doesn't uphold the trait's contract. This is easily fixed by modifying the implementation of len and changing the assert statement to actually assert the correct behaviour. I also slightly modified a code comment to better reflect what the method returns.
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-25/+25
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-02-05Rollup merge of #39393 - ollie27:stab_impls, r=alexcrichtonCorey Farwell-7/+11
Fix a few impl stability attributes The versions show up in rustdoc.
2017-02-03Move rfind to DoubleEndedIterator, add tracking issue.Clar Charr-0/+58
2017-01-29Fix a few impl stability attributesOliver Middleton-7/+11
The versions show up in rustdoc.
2017-01-13Rollup merge of #38636 - shahn:extend, r=steveklabnikGuillaume Gomez-1/+4
Clarify Extend behaviour wrt existing keys This seems to be consistent with all the Extend implementations I found, and isn't documented anywhere else afaik.
2017-01-10Implement `iter::Sum` and `iter::Product` for `Result`Jake Goulding-0/+81
This introduces a private iterator adapter `ResultShunt`, which allows treating an iterator of `Result<T, E>` as an iterator of `T`.
2017-01-05For Extend, document collections allowing duplicate keysSebastian Hahn-1/+3
2016-12-27Clarify Extend behaviour wrt existing keysSebastian Hahn-1/+2
2016-12-04iter: Forward ExactSizeIterator methods for &mut IUlrik Sverdrup-1/+8
2016-11-10Add missing urls for FusedIterator and TrustedLen traitsGuillaume Gomez-7/+15
2016-11-08Add missing urls for Sum and Product traitsGuillaume Gomez-8/+16
2016-11-04Auto merge of #37356 - cristicbz:wrapsum, r=alexcrichtonbors-6/+11
Add impls for `&Wrapping`. Also `Sum`, `Product` impls for both `Wrapping` and `&Wrapping`. There are two changes here (split into two commits): - Ops for references to `&Wrapping` (`Add`, `Sub`, `Mul` etc.) similar to the way they are implemented for primitives. - Impls for `iter::{Sum,Product}` for `Wrapping`. As far as I know `impl` stability attributes don't really matter so I didn't bother breaking up the macro for two different kinds of stability. Happy to change if it does matter.
2016-11-04Link the tracking issue for TrustedLenUlrik Sverdrup-2/+2
2016-10-23Add `Sum` and `Product` impls for `Wrapping`Cristi Cobzarenco-6/+11
2016-10-20Document TrustedLen’s contractUlrik Sverdrup-1/+13