Skip to content

Add position to Enumerate #129784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Add position to Enumerate #129784

wants to merge 1 commit into from

Conversation

x4exr
Copy link
Contributor

@x4exr x4exr commented Aug 30, 2024

In situations where the iterator progresses due to a function call, it may be tedious to determine the current position/count of the iterator.

fn do_iter(iter: &mut Enumerate<Chars<'a>>) {
    // ...
}

fn main() {
    do_iter(&mut i);

    // An iterator being used for parsing may want to compare the original position to the end position.
}

@rustbot
Copy link
Collaborator

rustbot commented Aug 30, 2024

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 30, 2024
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#16 2.845 Building wheels for collected packages: reuse
#16 2.846   Building wheel for reuse (pyproject.toml): started
#16 3.093   Building wheel for reuse (pyproject.toml): finished with status 'done'
#16 3.094   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132715 sha256=dfa09868353292d98f811d3efdb0d54d07389e808efc71d68e3b93c514bf8bec
#16 3.095   Stored in directory: /tmp/pip-ephem-wheel-cache-e_kns945/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#16 3.097 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#16 3.492 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#16 3.493 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#16 DONE 3.6s

@scottmcm
Copy link
Member

If you want to add a new API to the standard library, please follow the instructions in https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html#suitability-for-the-standard-library and start by making a case for the API in an ACP.

Then you can re-open this PR if the ACP is approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants