rust-lang / rust-lang/rfcs

Splitting variants of str::starts_with and ends_with

Open
#1,262 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

More often than not, when using starts_with or ends_with I actually want to do something with the remaining slice and have to split it out manually, e.g.:

    if s.starts_with(prefix) {
        let part = &s[prefix.len()..];
        // ...
    }

it would be more convenient to just do

    if let Some(part) = s.starts_split(prefix) {
        // ...
    }

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

Start with the starts_with and ends_with examples in this issue; no source file, test, or entry point is named. Work out the proposed split-method behavior and API shape, then consider the issue complete when the design is settled and documented for implementation.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.