about summary refs log tree commit diff
path: root/src/libcore/iter.rs
AgeCommit message (Collapse)AuthorLines
2015-11-05Rollup merge of #29539 - shepmaster:empty-iterator-docs, r=GankroSteve Klabnik-0/+8
2015-11-03Mention what iterator terminators do with an empty iteratorJake Goulding-0/+8
2015-10-29doc: make example more simpleTshepang Lekhonkhobe-3/+3
2015-10-27Adds tons of documentation for IteratorSteve Klabnik-261/+1183
This adds lots of examples, clarifies text, and just generally improves the documentation for Iterator.
2015-10-25Auto merge of #29266 - apasel422:wf, r=alexcrichtonbors-1/+1
Using these traits in an object context previously resulted in an RFC 1214 warning.
2015-10-25Auto merge of #29254 - alexcrichton:stabilize-1.5, r=brsonbors-9/+17
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
2015-10-25std: Stabilize library APIs for 1.5Alex Crichton-9/+17
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
2015-10-23Make `{Default, From, FromIterator, One, Zero}` well-formedAndrew Paseltiner-1/+1
Using these traits in an object context previously resulted in an RFC 1214 warning.
2015-10-23Document a bunch of std::iter traitsSteve Klabnik-25/+315
This adds a bunch of documentation for most of the traits in std::iter
2015-10-19Rollup merge of #29169 - apasel422:spell, r=steveklabnikSteve Klabnik-1/+1
r? @steveklabnik
2015-10-19Rollup merge of #29027 - steveklabnik:iter_docs, r=manishearthSteve Klabnik-20/+137
Due to the way iterators work, the std::iter module is chock full of structs that you, humble Rust programmer, will never actually use. However, they have URLs, and therefore get linked to, because they are real structs that do exist. So, rather than just have a tiny sentence about each one of them, this patch adds links back to the functions and methods on Iterator which actually create the structs, where helpful documentation already exists.
2015-10-19Correct spelling in docsAndrew Paseltiner-1/+1
2015-10-18docs: change where clause to boundLiigo Zhuang-1/+1
https://github.com/rust-lang/rust/blob/master/src/libcore/iter.rs#L1541
2015-10-15Rollup merge of #29022 - apasel422:spell, r=steveklabnikManish Goregaokar-1/+1
r? @steveklabnik
2015-10-14Properly link up iterator documentationSteve Klabnik-20/+137
Due to the way iterators work, the std::iter module is chock full of structs that you, humble Rust programmer, will never actually use. However, they have URLs, and therefore get linked to, because they are real structs that do exist. So, rather than just have a tiny sentence about each one of them, this patch adds links back to the functions and methods on Iterator which actually create the structs, where helpful documentation already exists.
2015-10-13Document the free functions of std::iterSteve Klabnik-1/+109
Flesh the docs out with examples.
2015-10-13Correct spelling in docsAndrew Paseltiner-1/+1
2015-10-12Auto merge of #28914 - steveklabnik:doc_iterator, r=alexcrichtonbors-29/+271
This replaces what was there with a comprehensive overview. Thanks to @hoverbear for suggesting that these docs needed improvement.
2015-10-12Write better module-level docs for std::iterSteve Klabnik-29/+271
This replaces what was there with a comprehensive overview.
2015-10-08Format code-like text in Iterator::cloned doc-commentCorey Farwell-1/+1
2015-10-07Auto merge of #28877 - sourcefrog:doc-fuse, r=alexcrichtonbors-0/+3
2015-10-06Link from Fuse type docstring to iter.fuse that creates themMartin Pool-0/+3
2015-10-02libcore: Chain must exhaust a before b.Steven Allen-1/+6
part of #28810
2015-09-30Auto merge of #28738 - apasel422:peekable, r=alexcrichtonbors-9/+1
2015-09-29Derive `Clone` for `Peekable`Andrew Paseltiner-9/+1
2015-09-29Remove redundant uses of Iterator::by_ref()Ulrik Sverdrup-5/+5
2015-09-03take mapped function by mutable referencellogiq-4/+4
2015-09-03clippy improvements to iteratorsllogiq-6/+6
2015-08-27Auto merge of #28028 - tshepang:add-size_hint-example, r=alexcrichtonbors-0/+7
2015-08-27Auto merge of #27975 - sfackler:iter-order-methods, r=aturonbors-87/+212
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737 r? @alexcrichton
2015-08-26Make iter::order functions into methods on IteratorSteven Fackler-87/+212
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737
2015-08-26doc: add Iterator::size_hint exampleTshepang Lekhonkhobe-0/+7
2015-08-25Correct iterator adaptor ChainUlrik Sverdrup-25/+71
The iterator protocol specifies that the iteration ends with the return value `None` from `.next()` (or `.next_back()`) and it is unspecified what further calls return. The chain adaptor must account for this in its DoubleEndedIterator implementation. It uses three states: - Both `a` and `b` are valid - Only the Front iterator (`a`) is valid - Only the Back iterator (`b`) is valid The fourth state (neither iterator is valid) only occurs after Chain has returned None once, so we don't need to store this state. Fixes #26316
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-14/+27
2015-08-15Auto merge of #27845 - dylanmckay:abstract-pointer-size-away, r=alexcrichtonbors-1/+3
This patch rewrites code in several places which assume that the current target has either 32-bit or 64-bit pointers so that it can support arbitrary-width pointers. It does not completely remove all assumptions of pointer width, but it does reduce them significantly. There is a discussion [here](https://internals.rust-lang.org/t/adding-16-bit-pointer-support/2484/10) about the change.
2015-08-15Iterator::all() - document short-circuiting property parallel to any()Georg Brandl-0/+2
2015-08-15Reduce libcore/liballoc's dependence on pointer sizesDylan McKay-1/+3
2015-08-14Auto merge of #27641 - nikomatsakis:soundness-rfc-1214, r=nrcbors-1/+1
This PR implements the majority of RFC 1214. In particular, it implements: - the new outlives relation - comprehensive WF checking For the most part, new code receives warnings, not errors, though 3 regressions were found via a crater run. There are some deviations from RFC 1214. Most notably: - we still consider implied bounds from fn ret; this intersects other soundness issues that I intend to address in detail in a follow-up RFC. Fixing this without breaking a lot of code probably requires rewriting compare-method somewhat (which is probably a good thing). - object types do not check trait bounds for fear of encountering `Self`; this was left as an unresolved question in RFC 1214, but ultimately feels inconsistent. Both of those two issues are highlighted in the tracking issue, https://github.com/rust-lang/rust/issues/27579. #27579 also includes a testing matrix with new tests that I wrote -- these probably duplicate some existing tests, I tried to check but wasn't quite sure what to look for. I tried to be thorough in testing the WF relation, at least, but would welcome suggestions for missing tests. r? @nrc (or perhaps someone else?)
2015-08-12Fallout in libs -- misc missing bounds uncovered by WF checks.Niko Matsakis-1/+1
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-544/+1
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-09doc/core: fix description of `nth` functionVincent Bernat-2/+1
The "nth" element can be confusing. In an array context, we know indexes start from 0 but one may believe this is not the case with "nth". For example, would `.nth(1)` return the first (1th/1st) or the second element? Rephrase a bit to be less confusing.
2015-07-29Rollup merge of #27326 - steveklabnik:doc_show_use, r=GankroSteve Klabnik-7/+14
In spirit with https://internals.rust-lang.org/t/should-we-keep-including-obvious-imports-in-code-examples/2217, show the feature flags we're using in examples. (also one instance of 'use')
2015-07-27std: Deprecate a number of unstable featuresAlex Crichton-0/+13
Many of these have long since reached their stage of being obsolete, so this commit starts the removal process for all of them. The unstable features that were deprecated are: * cmp_partial * fs_time * hash_default * int_slice * iter_min_max * iter_reset_fuse * iter_to_vec * map_in_place * move_from * owned_ascii_ext * page_size * read_and_zero * scan_state * slice_chars * slice_position_elem * subslice_offset
2015-07-27Show appropriate feature flags in docsSteve Klabnik-7/+14
2015-07-20s/has gained/has not gained/gPaolo Falabella-4/+4
I'm pretty sure this was a typo
2015-07-01Make the unused_mut lint smarter with respect to locals.Ariel Ben-Yehuda-2/+2
Fixes #26332
2015-06-17More test fixes and fallout of stability changesAlex Crichton-2/+20
2015-06-17std: Stabilize the `iter_{once,empty}` featuresAlex Crichton-12/+12
This commit stabilizes these two iterator primitives as they have gone through the RFC process and had some time to bake now.
2015-06-17std: Deprecate iter::{Unfold, Iterate}Alex Crichton-0/+12
Neither of these iterators has seen enough usage to justify their position in the standard library, so these unstable iterators are being slated for deletion.
2015-06-17std: Deprecate the RandomAccessIterator traitAlex Crichton-0/+4
This trait has not proven itself over time as being core and fundamentally useful to iterators, so it's being deprecated to allow time to iterate on it out of tree.