rust-lang/rfcs — pull request #528 by Kimundi (2014-12-16 02:27:43+00:00)
Title: Add a generic string pattern matching API

# Summary

Stabilize all string functions working with search patterns around a new
generic API that provides a unified way to define and use those patterns.

# Motivation

Right now, string slices define a couple of methods for string
manipulation that work with user provided values that act as
search patterns. For example, `split()` takes an type implementing `CharEq`
to split the slice at all codepoints that match that predicate.

Among these methods, the notion of what exactly is being used as a search
pattern varies inconsistently: Many work with the generic `CharEq`,
which only looks at a single codepoint at a time; and some
work with `char` or `&str` directly, sometimes duplicating a method to
provide operations for both.

This RFC proposes a set of traits for defining such patterns, which enable efficient iteration through all matches in a string.

[Rendered](https://github.com/Kimundi/rfcs/blob/string-pattern/text/0000-string-patterns.md)