byte_pattern: share the TwoWaySearcher between byte and str by folkertdev · Pull Request #135931 · rust-lang/rust (original) (raw)

tracking issue: #134149

An attempt to break up #134350 into more manageable pieces.

From what I can see, the TwoWaySearcher implementation does not have special logic for UTF8 boundaries, so it should work just as well on any &[u8]. So this PR just moves the TwoWaySearcher implementation to slice/byte_pattern.rs, and then uses it from str/pattern.rs. No functional changes, no additional API surface.

r? @BurntSushi