Lzu Tao
3fb3c0c0bd
Remove unneeded link for Option
2020-07-17 13:00:50 +00:00
LeSeulArtichaut
0891496898
Improve documentation on iterators
2020-02-16 17:12:26 +01:00
Yuki Okushi
7e2d7e0bbc
Stabilize core::iter::once_with()
2020-02-04 00:47:04 +09:00
Waffle
db1a107b3f
Fill tracking issue for iter_map_while
feature
2020-01-28 21:30:34 +03:00
Waffle
1aff08010d
Add Iterator::map_while
method and corresponding MapWhile
adapter
2020-01-28 21:30:34 +03:00
Mark Rousskov
65e366064f
docs: Iterator adapters have unspecified results after a panic
2019-12-23 11:56:08 -05:00
Mark Rousskov
a06baa56b9
Format the world
2019-12-22 17:42:47 -05:00
Lzu Tao
bb1f4c47c1
doc: reword iter module example and mention other methods
2019-10-30 15:52:28 +00:00
Tim Vermeulen
2e41ba8742
Use internal iteration in the Sum and Product impls of Result and Option
2019-07-29 02:40:50 +02:00
Stargateur
3334802c83
Refactoring use commun code between option, result and accum
2019-07-27 02:17:56 +02:00
Christian
b560b9cd36
Updated the Iterator docs with information about overriding methods.
2019-05-27 16:17:39 +02:00
Mazdak Farrokhzad
b71f8d4e1b
Stabilize Iterator::copied in 1.36.0.
2019-04-27 16:45:30 +02:00
Taiki Endo
360432f1e8
libcore => 2018
2019-04-18 14:47:35 +09:00
Vincent Esche
698bbe5253
Replaced self-reflective explicit types with clearer Self
or Self::…
in stdlib docs
2019-03-18 13:57:51 +01:00
Simon Sapin
3906cb9187
Stabilize iter::from_fn
...
FCP: https://github.com/rust-lang/rust/issues/55977#issuecomment-463964234
2019-02-19 14:10:07 +01:00
Simon Sapin
95d2795907
Stabilize iter::successors
...
FCP: https://github.com/rust-lang/rust/issues/58045#issuecomment-464674773
2019-02-19 13:58:55 +01:00
Simon Sapin
61e92b586b
Rename iter::unfold to iter::from_fn and remove explicit state
...
This API is unstable.
CC https://github.com/rust-lang/rust/issues/55977#issuecomment-459657195
2019-02-01 23:59:11 +01:00
Clar Fon
5971ccc08d
Don't expose ZipImpl to Iterator
2019-01-22 17:45:11 -05:00
Clar Fon
53b400c30c
Don't expose FlattenCompat to Iterator
2019-01-22 17:45:11 -05:00
Clar Fon
7e4177311a
Don't expose ChainState to Iterator
2019-01-22 17:45:11 -05:00
Clar Fon
520e8b001e
Move TrustedRandomAccess into Zip module
2019-01-22 17:45:11 -05:00
Clar Fon
c40450ce65
Move core::iter iterator.rs to traits module
2019-01-22 17:45:11 -05:00
Clar Fon
aff7772a1d
Move core::iter adapters to adapters.rs
2019-01-22 17:45:10 -05:00
Mazdak Farrokhzad
ae1ab8afa9
Rollup merge of #57579 - stjepang:once-with, r=SimonSapin
...
Add core::iter::once_with()
Functions `iter::once()` and `iter::repeat()` construct iterators from values. The latter has the lazy variant `iter::repeat_with()`, but the former doesn't. This PR therefore adds `iter::once_with()`.
Another way to think of `iter::once_with()` is that it's a function that converts `FnOnce() -> T` into `Iterator<Item = T>`.
If this seems like a reasonable addition, I'll open a tracking issue and update the `#[feature(...)]` attributes.
2019-01-15 12:42:10 +01:00
Stjepan Glavina
7915732714
Fix intradoc link and update issue number
2019-01-13 21:24:15 +01:00
Stjepan Glavina
04c74f46f0
Add core::iter::once_with
2019-01-13 16:58:08 +01:00
Taiki Endo
da933cca1a
Change #[must_use] message of Iterator in documentation
2019-01-13 15:17:57 +09:00
Taiki Endo
a6535d78dc
Change #[must_use] message of Iterator
2019-01-13 14:46:42 +09:00
bors
a7be40c65a
Auto merge of #56534 - xfix:copied, r=@SimonSapin
...
Add unstable Iterator::copied()
Initially suggested at https://github.com/bluss/rust-itertools/pull/289 , however the maintainers of itertools suggested this may be better of in a standard library.
The intent of `copied` is to avoid accidentally cloning iterator elements after doing a code refactoring which causes a structure to be no longer `Copy`. This is a relatively common pattern, as it can be seen by calling `rg --pcre2 '[.]map[(][|](?:(\w+)[|] [*]\1|&(\w+)[|] \2)[)]'` on Rust main repository. Additionally, many uses of `cloned` actually want to simply `Copy`, and changing something to be no longer copyable may introduce unnoticeable performance penalty.
Also, this makes sense because the standard library includes `[T].copy_from_slice` to pair with `[T].clone_from_slice`.
This also adds `Option::copied`, because it makes sense to pair it with `Iterator::copied`. I don't think this feature is particularly important, but it makes sense to update `Option` along with `Iterator` for consistency.
2018-12-26 19:39:19 +00:00
Konrad Borowski
315401ddf8
Add a tracking issue for Iterator::copied
2018-12-26 10:13:44 +01:00
Mark Rousskov
2a663555dd
Remove licenses
2018-12-25 21:08:33 -07:00
Konrad Borowski
8ac5380ea0
Merge branch 'master' into copied
2018-12-23 16:47:11 +01:00
Clar Fon
fb18ddaaaa
Add DoubleEndedIterator::nth_back
2018-12-20 01:18:04 -05:00
Shotaro Yamada
f0483f76e6
Remove <Cycle as Iterator>::try_fold
override
...
It was a incorrect optimization.
2018-12-17 15:00:22 +09:00
Shotaro Yamada
5728a043e8
Don't call size_hint of underlying iterator needlessly
2018-12-09 00:01:09 +09:00
Shotaro Yamada
e704ce9e8a
Resolve FIXME and cleanup
2018-12-09 00:01:09 +09:00
Shotaro Yamada
fbe5aa57ed
Override Cycle::try_fold
...
name old ns/iter new ns/iter diff ns/iter diff % speedup
iter::bench_cycle_take_ref_sum 927,152 927,194 42 0.00% x 1.00
iter::bench_cycle_take_sum 938,129 603,492 -334,637 -35.67% x 1.55
2018-12-09 00:01:09 +09:00
Konrad Borowski
b4a306c1e6
Avoid calling clone in DoubleEndedIterator implementation of Copied
2018-12-05 17:55:53 +01:00
Konrad Borowski
3eddc743f2
Use inner iterator may_have_side_effect for Cloned
...
Previous implementation wasn't correct, as an inner iterator
could have had side effects.
2018-12-05 16:48:34 +01:00
Konrad Borowski
431968df37
Copy may_have_side_effect from I for Copied<I>
2018-12-05 16:42:20 +01:00
Konrad Borowski
3ee0747b5a
Use copied method instead of cloned in Copied::next_back()
2018-12-05 16:37:55 +01:00
Konrad Borowski
ab2cd6070e
Add unstable Iterator::copied()
2018-12-05 15:40:14 +01:00
Simon Sapin
a4279a07e2
Capitalize
2018-11-20 18:22:40 +01:00
Simon Sapin
8a5bbd9a4e
Add tracking issue for unfold and successors
2018-11-20 18:22:40 +01:00
Simon Sapin
641c4909e4
Add std::iter::successors
2018-11-20 18:22:40 +01:00
Simon Sapin
48aae09e9f
Add std::iter::unfold
2018-11-20 18:22:40 +01:00
Артём Павлов [Artyom Pavlov]
126b71f690
revert
2018-11-18 21:39:23 +03:00
varkor
f5b89062f6
Unused result warning: "X which must" ↦ "X that must"
2018-10-14 18:25:30 +01:00
Aleksey Kladov
1a0d3f0979
Fix since of Iterator::flatten to be a proper semver
2018-08-15 19:28:42 +03:00
kennytm
6093128ef3
Changed implementation of the third field to make LLVM optimize it better.
2018-07-13 13:26:07 +08:00