Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
rustexp.lpil.uk
...K keep text out of match \G anchor to previous match \Z anchor to the end of the text before any trailing newlines \O any character including newline Capture groups and backreferences \1 match first capture group \2 match second capture group \{N} match Nth capture group (?<name> exp) capture...
Crate of the Week 2019-07-09 ~1 min read
docs.rs
...Structured like match statement, the first matching branch is the item that gets emitted. match_cfg Documentation Minimum Supported Rust Version : 1.13.0. A convenience macro to ergonomically define an item depending on a large number of #[cfg] parameters. Structured like match statement, the first matching branch is the...
Crate v0.1.0 2019-04-02
rust.code-maven.com
...Using match on Option fn match_on_option(animal: &str) { let text = "The black cat climbed the green tree"; match text.find(animal) { Some(location) => println!("Location of {animal}: {location}"), None => println!("None received - no {animal} found"), }; } Calling match_on_option("cat"); will print Location of cat: 10. Calling match...
Miscellaneous 2024-01-10 ~3 min read
andreabergia.com
...fn match_cmp(input) { if let Ok(rule) = match_eq(input) { return rule; } if let Ok(rule) = match_neq(input) { return rule; } if let Ok(rule) = match_lt(input) { return rule; } if let Ok(rule) = match_lte(input) { return rule; } if let Ok(rule) = match_gt(input) { return rule; } if...
Rust Walkthroughs 2025-08-27 ~3 min read
featherweightmusings.blogspot.co.nz
...As I said earlier, if you want to match some `x` with type `&T` you can dereference once in the match clause or match the reference in every arm of the match expression. Example: enum Enum1 {    Var1,    Var2,    Var3}fn foo(x: &Enum1) {    match *x {  // Option 1: deref here.        Var1...
Community Updates 2014-04-26 ~9 min read
docs.rs
Fuzzy Matching Library Fuzzy Matcher Fuzzy matching algorithm(s) in Rust! Usage In your Cargo.toml add the following: [dependencies] fuzzy-matcher = "*" Here are some code example: use fuzzy_matcher::FuzzyMatcher; use fuzzy_matcher::skim::SkimMatcherV2; let matcher = SkimMatcherV2::default(); assert_eq!(None, matcher.fuzzy_match("abc", "abx")); assert!(matcher...
Crate v0.3.7 2020-10-04
www.wakunguma.com
...let val = (|(..):(_,_),(|__@_|__)|)((&*"\\",'🤔'),{}) Match fn r#match() { let val: () = match match match match match () { () => () } { () => () } { () => () } { () => () } { () => () }; assert_eq!(val, ()); } This is just matching nested match statements. Match nested if fn match_nested_if() { let val = match () { () if if if if true {true} else {false} {true} else {false} {true} else {false} => true, _ => false...
Observations/Thoughts 2025-06-25 ~12 min read
zkrising.com
...Which brings us to match. What is a match?// match is a list of patterns and what to do if they match. // // match EXPR { // PAT => EXPR // PAT => EXPR // .. // } match (a, b) { (5, x) => { // if (a,b) matches (5,x), this block is executed }, (x, 5) => { // same thing: if (a,b...
Rust Walkthroughs 2024-11-06 ~7 min read
github.com
## Summary Allow attributes on match arms. ## Motivation One sometimes wishes to annotate the arms of match statements with attributes, for example with conditional compilation `#[cfg]`s or with branch weights (the latter is the most important use). For the conditional compilation, the work-around is duplicating the whole containing function...
RFC 49 RFC 2014-03-20 ~1 min read
github.com
## Summary [summary]: #summary The current compiler implements a more expansive semantics for pattern matching than was originally intended. This RFC introduces several mechanisms to reign in these semantics without actually breaking (much, if any) extant code: - Introduce a feature-gated attribute `#[structural_match]` which can be applied to a struct...
RFC 1445 RFC 2015-02-06 ~17 min read
doc.rust-lang.org
pub fn rmatch_indices<P>(&self, pat: P) -> RMatchIndices<'_, P>
str::rmatch_indices — Returns an iterator over the disjoint matches of a pattern within self, yielded in reverse order along with the index of the match. For matches of pat within self that overlap, only the indices corresponding to the last match are returned. The pattern can be a &str...
method core Stable since 1.5.0 Version 1.100.0-nightly
doc.rust-lang.org
Concise Control Flow with if let and let...else The if let syntax lets you combine if and let into a less verbose way to handle values that match one pattern while ignoring the rest. Consider the program in Listing 6-6 that matches on an Option<u8> value in...
The Rust Programming Language Book 2024-02-01 ~4 min read
github.com
## Summary [summary]: #summary Extend Rust's pattern matching exhaustiveness checks to cover the integer types: `u8`, `u16`, `u32`, `u64`, `u128`, `usize`, `i8`, `i16`, `i32`, `i64`, `i128`, `isize` and `char`. ```rust fn matcher_full(x: u8) { match x { // ok 0 ..= 31 => { /* ... */ } 32 => { /* ... */ } 33 ..= 255 => { /* ... */ } } } fn matcher_incomplete(x: u8) { match x...
RFC 2591 RFC 2018-10-11 ~3 min read
github.com
## Summary [summary]: #summary This RFC proposes to add a new kind of pattern, the **guard pattern.** Like match arm guards, guard patterns restrict another pattern to match only if an expression evaluates to `true`. The syntax for guard patterns, `pat if condition`, is compatible with match arm guard syntax, so...
RFC 3637 RFC 2024-05-13 ~12 min read
doc.rust-lang.org
...Whether a Pattern Might Fail to Match Patterns come in two forms: refutable and irrefutable. Patterns that will match for any possible value passed are irrefutable. An example would be x in the statement let x = 5; because x matches anything and therefore cannot fail to match. Patterns that can...
The Rust Programming Language Book 2024-02-01 ~2 min read
github.com
## Table of contents * [Summary][summary] * [Motivation][motivation] * [Detailed design][design] * [Syntax][syntax] * [Evolution][evolution] * [Concrete syntax][concrete-syntax] * [Expansion concerns][expansion-concerns] * [Core API][core-api] * [RegexBuilder][regexbuilder] * [Replacer][replacer] * [quote][quote] * [RegexSet][regexset] * [The `bytes` submodule][the-bytes-submodule] * [Drawbacks][drawbacks] * [Guaranteed linear time matching][guaranteed-linear-time-matching...
RFC 1620 RFC 2016-05-11 ~30 min read
docs.rs
...let matches: Vec<_> = set.matches("foobar").into_iter().collect(); assert_eq!(matches, vec![0, 2, 3, 4, 6]); // You can also test whether a particular regex matched: let matches = set.matches("foobar"); assert!(!matches.matched(5)); assert!(matches.matched(6)); Usage: regex internals as a library The regex-automata directory...
Crate v1.13.1 2026-07-15
crates.io
Statically assert that a type matches another type assert_type_match A niche utility macro to statically assert that a type matches another type. Purpose The primary purpose of this crate is to make copying and pasting types from other crates into your own more future-proof by statically asserting...
Crate v0.1.1 2024-09-23
notes.iveselov.info
hashtagIntroductionIn Haskell, pattern matching is mostly nice and easy. It might be made more complicated by strictness annotations (i.e. whether to evaluate sub-patterns lazily or strictly) or irrefutability annotations, but it doesn't have any special interactions with ownership, borrowing and mutability which are bread and butter of...
News & Blog Posts 2020-03-31 ~9 min read
github.com
## Summary [summary]: #summary Various changes to the match ergonomics rules: - On edition ≥ 2024, `&` and `&mut` patterns only remove a single layer of references. - On edition ≥ 2024, `mut` on an identifier pattern does not force its binding mode to by-value. - On all editions, `&` patterns can match against `&mut` references. - On...
RFC 3627 RFC 2024-05-06 ~15 min read

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.