Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[SR-10663] Collection Searchers ("Needle") Protocol #53062

Open
milseman mannequin opened this issue May 11, 2019 · 1 comment
Open

[SR-10663] Collection Searchers ("Needle") Protocol #53062

milseman mannequin opened this issue May 11, 2019 · 1 comment
Labels
standard library Area: Standard library umbrella

Comments

@milseman
Copy link
Mannequin

milseman mannequin commented May 11, 2019

Previous ID SR-10663
Radar None
Original Reporter @milseman
Type Sub-task
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Sub-task
Assignee None
Priority Medium

md5: a77fc420964e7e03cb2f70ba3aeb3a2a

Parent-Task:

Issue Description:

Swift's standard library should provide a protocol that searching-like functionality can conform to, to allow for many implementations that can fulfill find/replace/split/trim/etc. This would likely be something analogous to Rust's Needle (formerly str::Pattern) https://github.com/rust-lang/rfcs/blob/master/text/2500-needle.md.

Some potential conformers to this protocol (using String for an example in parens):

  • `Collection.Element` (find a Character)

  • `Set<Collection.Element>` (any of a choice of Characters)

  • `(Collection.Element) -> Bool` (predicate version / generalization of above 3)

  • `S: Sequence where S.Element == Collection.Element` (find a substring)

  • `Regex` (regular expression matches)

  • `PEG` (parses)

@milseman
Copy link
Mannequin Author

milseman mannequin commented May 11, 2019

A good use case could be conforming part of https://github.com/ctxppc/PatternKit

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

0 participants