Repository: rust
Issue: Tracking Issue for `byte_search`
Labels: T-libs-api,C-tracking-issue

<!--
Thank you for creating a tracking issue!

Tracking issues are for tracking a feature from implementation to stabilization.

Make sure to include the relevant RFC for the feature if it has one.

If the new feature is small, it may be fine to skip the RFC process. In that
case, you can use `issue = "none"` in your initial implementation PR. The
reviewer will ask you to open a tracking issue if they agree your feature can be
added without an RFC.
-->

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](
https://doc.rust-lang.org/std/str/pattern/trait.Pattern.html).

```rust
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

<!--
For larger features, more steps might be involved.
If the feature is changed later, please add those PRs here as well.
-->

- [ ] ACP: https://github.com/rust-lang/libs-team/issues/499#issuecomment-2532563916, https://github.com/rust-lang/libs-team/issues/311
- [ ] Implementation: #...
- [ ] Final comment period (FCP)[^1]
- [ ] Stabilization PR

<!--
Once the feature has gone through a few release cycles and there are no
unresolved questions left, the feature might be ready for stabilization.

If this feature didn't go through the RFC process, a final comment period
(FCP) is always needed before stabilization. This works as follows:

A library API team member can kick off the stabilization process, at which point
the rfcbot will ask all the team members to verify they agree with
stabilization. Once enough members agree and there are no concerns, the final
comment period begins: this issue will be marked as such and will be listed
in the next This Week in Rust newsletter. If no blocking concerns are raised in
that period of 10 days, a stabilization PR can be opened by anyone.
-->

### Unresolved Questions

<!--
Include any open questions that need to be answered before the feature can be
stabilised. If multiple (unrelated) big questions come up, it can be a good idea
to open a separate issue for each, to make it easier to keep track of the
discussions.

It's useful to link any relevant discussions and conclusions (whether on GitHub,
Zulip, or the internals forum) here.
-->

- None yet.

[^1]: https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html