rust-lang / rust-lang/rust

Tracking Issue for `byte_search`

Open
#134,149 0 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Feature gate: #![feature(byte_search)]
acp: https://github.com/rust-lang/libs-team/issues/499

This is a tracking issue for byte searching: searching for a particular pattern of bytes in a &[u8], and potentially trimming, splitting or otherwise processing the input based on the matches of the pattern.

Public API

The API mirrors the one for strings at std::str::pattern::Pattern.

pub trait BytePattern: Sized {
    /// Associated searcher for this pattern
    type Searcher<'a>: Searcher<'a>;

    // etc.
}

and then adds a number of inherent methods for &[u8]. The exact set has not yet been decided, but will likely include (modulo slight naming changes):

  • contains_bytes
  • find_bytes
  • rfind_bytes
  • split_bytes
  • rsplit_bytes
  • split_bytes_once
  • rsplit_bytes
  • splitn_bytes
  • rsplitn_bytes
  • replace_bytes
  • replacen_bytes
  • starts_with_bytes
  • ends_with_bytes
  • matches_bytes
  • rmatches_bytes
  • match_indices_bytes
  • rmatch_indices_bytes
  • trim_bytes_start_matches
  • trim_bytes_end_matches
  • strip_bytes_prefix
  • strip_bytes_suffix
Steps / History
Unresolved Questions
  • None yet.

Contributor guide

Open the contributing guide

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 ACP links and the public API section, including std::str::pattern::Pattern and the proposed byte-search methods. Review the feature-gate and implementation checklist; this issue is complete only after the API and implementation are decided, followed by FCP and a stabilization PR.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.