Pattern
A pattern is a specification of criteria used to match values or text.
Learn Rust in a Month of Lunches
Pattern is a Rust string-matching trait implemented by supported search patterns such as string slices, characters, and closures.
- How it is used
- Introduces Pattern as the trait governing accepted search inputs for .match_indices().
- How deep it goes
- Names supported input types and demonstrates their use while deferring details of the trait.
- Examples
- Searches German text with a character-testing closure and the string slice ". ", printing matches and indices.
- What you can do after
- Apply it via .match_indices() to find matching text and its indices.
Read how Learn Rust in a Month of Lunches explains pattern →
Type-Driven Development with Idris
A syntactic form that describes the shape or value an input must match for a function clause to apply.
- How it is used
- Uses patterns to define function behavior for possible input shapes and values.
- How deep it goes
- Works through constructor discovery, interactive case splitting, variable binding, and recursive clauses.
- Examples
- Uses Boolean exclusive OR, recursive evenness on Nat, and word lengths over a list.
- What you can do after
- Apply it via Idris and Atom to split input cases and implement recursive functions.
Read how Type-Driven Development with Idris explains pattern →
Related concepts
- case splittingproduced by · Case splitting is a development technique that divides an implementation into branches corresponding to the possible forms or values of an expression.
- data constructoruses · A data constructor is a language construct that creates a value of a data type, possibly with arguments.
Questions about pattern
What is pattern?
A pattern is a specification of criteria used to match values or text.
Which Manning books explain pattern?
Learn Rust in a Month of Lunches and Type-Driven Development with Idris.
What kinds of pattern are there?
Kinds of pattern include positional pattern, property pattern and complex url pattern.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

