forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: implement Pattern<&[T]> for &[T]; get rid of SlicePattern
Implement Haystack<&[T]> and corresponding Pattern<&[T]> for &[T]. That is, provide implementation for searching for subslices in slices. This replaces SlicePattern type. To make use of this new implementations, provide a few new methods on [T] type modelling them after types on str. Specifically, introduce {starts,ends}_with_pattern, find, rfind, [T]::{split,rsplit}_once and trim{,_start,_end}_matches. Note that due to existing starts_with and ends_with methods, the _pattern suffix had to be used. This is unfortunate but the type of starts_with’s argument cannot be changed without affecting type inference and thus breaking the API. This change doesn’t implement functions returning iterators such as split_pattern or matches which in str type are built on top of the Pattern API. Issue: rust-lang#49802 Issue: rust-lang#56345
- Loading branch information
Showing
4 changed files
with
1,294 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.