Add core::iter::once_with()#57579
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
|
cc @rust-lang/libs |
Contributor
|
r? @SimonSapin I once promised @eddyb to make a PR for this but the playground ate my work... :( |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
|
r=me, but the doc-comment still needs |
SimonSapin
reviewed
Jan 14, 2019
| /// over each file of the `.foo` directory, but also a configuration file, | ||
| /// `.foorc`: | ||
| /// | ||
| /// ```no_run |
Contributor
There was a problem hiding this comment.
I’d guess here too? IIRC no_run doc-tests are still compiled.
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit 3a1f013 has been approved by |
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jan 15, 2019
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.
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jan 15, 2019
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.
bors
added a commit
that referenced
this pull request
Jan 15, 2019
Rollup of 7 pull requests Successful merges: - #57253 (Make privacy checking, intrinsic checking and liveness checking incremental) - #57352 (forbid manually impl'ing one of an object type's marker traits) - #57537 (Small perf improvement for fmt) - #57579 (Add core::iter::once_with()) - #57587 (Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test) - #57608 (Simplify 'product' factorial example) - #57614 ([rustdoc] Fix crates filtering box not being filled) Failed merges: r? @ghost
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jan 15, 2019
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.
bors
added a commit
that referenced
this pull request
Jan 15, 2019
Rollup of 8 pull requests Successful merges: - #56044 (Drop partially bound function parameters in the expected order) - #57352 (forbid manually impl'ing one of an object type's marker traits) - #57456 (RawVec doesn't always abort on allocation errors) - #57467 (Implement `check_attribute` to forbid `#[allow_internal_unsafe]`) - #57579 (Add core::iter::once_with()) - #57587 (Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test) - #57608 (Simplify 'product' factorial example) - #57614 ([rustdoc] Fix crates filtering box not being filled) Failed merges: r? @ghost
kumbayo
reviewed
Jan 15, 2019
|
|
||
| /// An iterator that repeats elements of type `A` endlessly by | ||
| /// applying the provided closure `F: FnMut() -> A`. | ||
| /// |
There was a problem hiding this comment.
It seems like his comment was copy pasted from RepeatWith.
It talks about endless repeating and FnMut().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Functions
iter::once()anditer::repeat()construct iterators from values. The latter has the lazy variantiter::repeat_with(), but the former doesn't. This PR therefore addsiter::once_with().Another way to think of
iter::once_with()is that it's a function that convertsFnOnce() -> TintoIterator<Item = T>.If this seems like a reasonable addition, I'll open a tracking issue and update the
#[feature(...)]attributes.