Skip to content

Tracking Issue for byte_search #134149

New issue

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

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

Already on GitHub? # to your account

Open
4 tasks
folkertdev opened this issue Dec 10, 2024 · 0 comments
Open
4 tasks

Tracking Issue for byte_search #134149

folkertdev opened this issue Dec 10, 2024 · 0 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@folkertdev
Copy link
Contributor

folkertdev commented Dec 10, 2024

Feature gate: #![feature(byte_search)]
acp: rust-lang/libs-team#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.

Footnotes

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

@folkertdev folkertdev added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Dec 10, 2024
@folkertdev folkertdev changed the title Tracking Issue for bytes-search Tracking Issue for byte_search Dec 11, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant