Trait cow_utils::Pattern

source ·
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§

source

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§

source

fn match_indices_in(self, s: &'s str) -> Self::MatchIndices

A wrapper for &str::match_indices with a given pattern.

Implementations on Foreign Types§

source§

impl<'s> Pattern<'s> for &&str

source§

impl<'s> Pattern<'s> for char

source§

impl<'s> Pattern<'s> for &[char]

source§

impl<'s> Pattern<'s> for &str

source§

impl<'s> Pattern<'s> for &String

Implementors§

source§

impl<'s, F: FnMut(char) -> bool> Pattern<'s> for F