pub trait Pattern<'s> {
type MatchIndices: Iterator<Item = (usize, &'s str)>;
// Required method
fn match_indices_in(self, s: &'s str) -> Self::MatchIndices;
}Expand description
This trait is a shim for the required functionality
normally provided directly by std::str::pattern::Pattern
(which is currently unstable).
On stable Rust it’s implemented on the same standard types as
std::str::pattern::Pattern, but on nightly you can enable
a "nightly" feature and any custom types implementing
std::str::pattern::Pattern will be supported as well.
Required Associated Types§
Sourcetype MatchIndices: Iterator<Item = (usize, &'s str)>
type MatchIndices: Iterator<Item = (usize, &'s str)>
This will always be std::str::MatchIndices<'s, Self> but we can’t spell it out because it
requires Self: std::str::pattern::Pattern and that trait bound is
currently unstable and can’t be written in a stable Rust.
Required Methods§
Sourcefn match_indices_in(self, s: &'s str) -> Self::MatchIndices
fn match_indices_in(self, s: &'s str) -> Self::MatchIndices
A wrapper for &str::match_indices with a given pattern.