Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
crates.io
...extern crate clap; extern crate sys_mount; use clap::{App, Arg}; use sys_mount::{Mount, MountFlags, SupportedFilesystems}; use std::process::exit; fn main() { let matches = App::new("mount") .arg(Arg::with_name("source").required(true)) .arg(Arg::with_name("directory").required(true)) .get_matches(); let src = matches.value_of("source...
Crate v3.1.0 2026-01-29
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
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
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
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
rust-lang.github.io
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
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
rust-lang.github.io
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. fn matcher_full(x: u8) { match x { // ok 0 ..= 31 => { /* ... */ } 32 => { /* ... */ } 33 ..= 255 => { /* ... */ } } } fn matcher_incomplete(x: u8) { match x { //~ ERROR: non-exhaustive...
RFC 2591 RFC 2018-10-11 ~3 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
rust-lang.github.io
...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 existing guards can be superceded by guard patterns without breakage. Motivation Guard patterns, unlike match arm...
RFC 3637 RFC 2024-05-13 ~12 min read
rust-lang.github.io
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 or enum...
RFC 1445 RFC 2015-02-06 ~16 min read
crates.io
...This means that nucleo finds the optimal match more often. For example if you match foo in xf foo nucleo will match x__foo but fzf will match xf_oo (you can increase the word length the result will stay the same). The former is the more intuitive match and...
Crate v0.3.1 2024-02-20
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
rust-lang.github.io
Table of contents • Summary • Motivation • Detailed design • Syntax • Evolution • Concrete syntax • Expansion concerns • Core API • RegexBuilder • Replacer • quote • RegexSet • The bytes submodule • Drawbacks • Guaranteed linear time matching • Allocation • Synchronization is implicit • The implementation is complex • Alternatives • Big picture • bytes::Regex • A regex trait • Reuse some types • Unresolved questions • regex-syntax...
RFC 1620 RFC 2016-05-11 ~30 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
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.2 2026-11-19
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
"Clearly there is such a thing as too much syntactic sugar (as one of my professors put it, "syntactic sugar causes semantic cancer"), but at the same ..."

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.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
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.