rust-lang / rust-lang/rfcs

first() in iterator

Open
#2,833 23 comments 69 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

std::iter::Iterator has a method to get the last element, last(). But why isn't there a first() to get the first element?

There are times when first() comes handy, especially after filtering and/or sorting the items. Though it's possible to use nth(0) in such cases, first() would be cleaner.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names std::iter::Iterator, last(), and nth(0), but no repository file or test. Start by comparing those documented methods and the RFC process; done means a clear decision and accepted proposal for whether first() should be added.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.