std::str::pattern::Pattern - Rust (original) (raw)

Trait std::str::pattern::Pattern [−] [src]

pub trait Pattern<'a> { type Searcher: Searcher<'a>; fn into_searcher(self, haystack: &'a str) -> Self::Searcher;

fn [is_contained_in](#method.is%5Fcontained%5Fin)(self, haystack: &'a [str](../../primitive.str.html)) -> [bool](../../primitive.bool.html) { ... }
fn [is_prefix_of](#method.is%5Fprefix%5Fof)(self, haystack: &'a [str](../../primitive.str.html)) -> [bool](../../primitive.bool.html) { ... }
fn [is_suffix_of](#method.is%5Fsuffix%5Fof)(self, haystack: &'a [str](../../primitive.str.html)) -> [bool](../../primitive.bool.html)  

    where
        Self::Searcher: ReverseSearcher<'a>, { ... } }

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

A string pattern.

A Pattern<'a> expresses that the implementing type can be used as a string pattern for searching in a &'a str.

For example, both 'a' and "aa" are patterns that would match at index 1 in the string "baaaab".

The trait itself acts as a builder for an associatedSearcher type, which does the actual work of finding occurrences of the pattern in a string.

type [Searcher](#associatedtype.Searcher): [Searcher](../../../std/str/pattern/trait.Searcher.html "trait std::str::pattern::Searcher")<'a>

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

Associated searcher for this pattern

fn [into_searcher](#tymethod.into%5Fsearcher)(self, haystack: &'a [str](../../primitive.str.html)) -> Self::[Searcher](../../../std/str/pattern/trait.Pattern.html#associatedtype.Searcher "type std::str::pattern::Pattern::Searcher")

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

Constructs the associated searcher fromself and the haystack to search in.

fn [is_contained_in](#method.is%5Fcontained%5Fin)(self, haystack: &'a [str](../../primitive.str.html)) -> [bool](../../primitive.bool.html)

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

Checks whether the pattern matches anywhere in the haystack

fn [is_prefix_of](#method.is%5Fprefix%5Fof)(self, haystack: &'a [str](../../primitive.str.html)) -> [bool](../../primitive.bool.html)

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

Checks whether the pattern matches at the front of the haystack

`fn is_suffix_of(self, haystack: &'a str) -> bool where

Self::Searcher: ReverseSearcher<'a>, `

🔬 This is a nightly-only experimental API. (pattern #27721)

API not fully fleshed out and ready to be stabilized

Checks whether the pattern matches at the back of the haystack