pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://doc.rust-lang.org/reference/../../std/str/pattern/

.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>``).join(""))

Module pattern

Module pattern 

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

The string Pattern API.

The Pattern API provides a generic mechanism for using different pattern types when searching through a string.

For more details, see the traits Pattern, Searcher, ReverseSearcher, and DoubleEndedSearcher.

Although this API is unstable, it is exposed via stable APIs on the str type.

§Examples

Pattern is implemented in the stable API for &str, char, slices of char, and functions and closures implementing FnMut(char) -> bool.

let s = "Can you find a needle in a haystack?";

// &str pattern
assert_eq!(s.find("you"), Some(4));
// char pattern
assert_eq!(s.find('n'), Some(2));
// array of chars pattern
assert_eq!(s.find(&['a', 'e', 'i', 'o', 'u']), Some(1));
// slice of chars pattern
assert_eq!(s.find(&['a', 'e', 'i', 'o', 'u'][..]), Some(1));
// closure pattern
assert_eq!(s.find(|c: char| c.is_ascii_punctuation()), Some(35));

Structs§

CharArrayRefSearcherExperimental
Associated type for <&[char; N] as Pattern>::Searcher<'a>.
CharArraySearcherExperimental
Associated type for <[char; N] as Pattern>::Searcher<'a>.
CharPredicateSearcherExperimental
Associated type for <F as Pattern>::Searcher<'a>.
CharSearcherExperimental
Associated type for <char as Pattern>::Searcher<'a>.
CharSliceSearcherExperimental
Associated type for <&[char] as Pattern>::Searcher<'a>.
StrSearcherExperimental
Associated type for <&str as Pattern>::Searcher<'a>.

Enums§

SearchStepExperimental
Result of calling Searcher::next() or ReverseSearcher::next_back().
Utf8PatternExperimental
Result of calling Pattern::as_utf8_pattern(). Can be used for inspecting the contents of a Pattern in cases where the underlying representation can be represented as UTF-8.

Traits§

DoubleEndedSearcherExperimental
A marker trait to express that a ReverseSearcher can be used for a DoubleEndedIterator implementation.
PatternExperimental
A string pattern.
ReverseSearcherExperimental
A reverse searcher for a string pattern.
SearcherExperimental
A searcher for a string pattern.
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy