Files
rust/library/coretests/tests
Jacob Pratt 221dab89b4 Rollup merge of #139690 - cuviper:iter_repeat_n_default, r=tgross35
`impl Default for RepeatN`

This creates an empty iterator, like `repeat_n(value, 0)` but without
needing any such value at hand. There's precedent in many other
iterators that the `Default` is empty, like `slice::Iter`.

I found myself wanting this for rayon's `RepeatN` as it lowers to a
sequential iterator [here][1]. Since rayon is also optimizing to avoid
extra clones, it may end up with parallel splits that have count 0 and
no item value. Calling `std::iter::repeat_n(x, 0)` just drops that
value, but there's no way to construct the same result without a value
yet. This would be straightforward with an empty `Default`.

[1]: https://github.com/rayon-rs/rayon/blob/ae07384e3e0b238cea89f0c14891f351c65a5cee/src/iter/repeat.rs#L201-L202

r? libs-api (insta-stable)
2026-04-18 00:05:16 -04:00
..
2025-06-12 12:53:14 -04:00
2025-09-12 13:54:15 -05:00
2026-04-16 16:49:11 -07:00
2026-02-20 10:16:36 +01:00
2025-08-02 17:34:59 -04:00
2026-01-11 16:39:18 +03:00
2025-07-09 16:37:11 +00:00
2025-09-16 10:05:40 -05:00
2025-09-16 10:26:52 -05:00
2026-01-23 15:12:47 +07:00
2025-06-25 17:06:49 -07:00
2026-03-23 08:17:14 -04:00
2025-12-12 06:31:00 +02:00
2026-04-08 17:59:14 +02:00
2025-01-26 10:26:36 +00:00
2025-01-26 10:26:36 +00:00
2025-10-26 21:33:00 -04:00
2026-02-20 10:16:36 +01:00
2025-01-26 10:26:36 +00:00
2025-09-10 16:50:45 -05:00
2025-01-26 10:26:36 +00:00
2025-05-12 15:33:37 +02:00
2026-03-25 11:40:27 +07:00
2025-08-01 08:55:50 +03:00
2025-01-26 10:26:36 +00:00
2026-01-29 11:12:54 -08:00
2025-01-26 10:26:36 +00:00
2025-01-26 10:26:36 +00:00
2025-08-20 20:31:33 -04:00