str::match_indices returns an iterator for a single pattern. If you have multiple patterns, you won't be able to optimize it beyond quadratic time complexity. The best you can do is use iterator adapters to sugar over the syntax. It won't be any faster. Rust Playground
You can write your own parser with something like nom that will be faster than calling match_indices multiple times