Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
blog.sheerluck.dev
...And we matched on it: let regex = match Regex::new(pattern) { Ok(r) => r, Err(e) => { eprintln!("Invalid pattern: {}", e); std::process::exit(1); } }; Now we're going to go much deeper. Pattern Matching on Result Just like Option, you can match on Result: match result { Ok(value) => println!("success...
Rust Walkthroughs 2026-05-06 ~27 min read
github.com
...On floats are raw pointers, pattern matching behaves like `==`, which means in particular that the value `-0.0` matches the pattern `0.0`, and NaN values match no pattern (except for wildcards). ### Breaking changes This RFC breaks code that compiles today, but only code that already emits a future compatibility...
RFC 3535 RFC 2023-11-19 ~17 min read
github.com
...maybe_label FOR top_pat IN expr_nostruct block ; ``` For `match` expressions we now have: ```rust expr_match : MATCH expr_nostruct '{' match_clause* nonblock_match_clause? '}' ; match_clause : nonblock_match_clause ',' | block_match_clause ','? ; nonblock_match_clause : match_arm (nonblock_expr | block_expr_dot) ; block_match_clause : match_arm (block...
RFC 2535 RFC 2018-08-29 ~19 min read
home.expurple.me
Table of ContentsThe “Error Handling” seriesLibrary vs application needsDon’t use one big enum for everythingModularityPrecise signaturesFlat vs nested enumsFlat enumsNested enumsWorkarounds for pattern matching nested enumsOther tipsWhen to reuse an error type between multiple functionsWhere to put error typesDon’t create one-variant enumsnon_exhaustiveNaming error variantsPrivacy of fieldsMixing...
Rust Walkthroughs 2026-01-28 ~12 min read
morestina.net
Let’s say you need to match the same regex across a large number of strings – perhaps you’re applying a grep-like filter to data generated or received by your program. This toy example demonstrates it by matching a regex against half a billion strings: use regex::Regex; lazy...
Observations/Thoughts 2022-10-26 ~3 min read
aarol.dev
...Key) -> &'static str { use Key::*; match *LANG { Lang::En => match key { battery_remaining => "remaining", no_adapter_found => "No headphone adapter found", view_logs => "View logs", view_updates => "View updates", quit_program => "Close", device_charging => "(Charging)", device_disconnected => "(Disconnected)", version => "Version", }, Lang::Fi => match key { battery_remaining => "jäljellä", no_adapter_found...
Observations/Thoughts 2025-05-14 ~2 min read
github.com
## Summary Change pattern matching on an `&mut T` to `&mut <pat>`, away from its current `&<pat>` syntax. ## Motivation Pattern matching mirrors construction for almost all types, *except* `&mut`, which is constructed with `&mut <expr>` but destructured with `&<pat>`. This is almost certainly an unnecessary inconsistency. This can and does lead...
RFC 179 RFC 2015-01-04 ~2 min read
github.com
...Exact match search The method finds a value associated with an exact match key as a Option . Requirements Rust version >= 1.58.0 Usage See also example code for more details. Build a double-array trie use yada::builder::DoubleArrayBuilder; // make a keyset which have key-value pairs let keyset...
Crate v0.7.0 2026-06-06
rust-analyzer.github.io
...SSR now matches paths based on whether they resolve to the same thing instead of whether they’re written the same. So foo() won’t match foo() if it’s a different function foo(), but will match bar::foo() if it’s the same foo. Paths in the replacement will...
Tooling 2020-07-28 ~1 min read
github.com
...An individual `#[cfg(...)]` attribute "matches" if *all* of the contained cfg patterns match the compilation environment, and an item preserved if it *either* has no `#[cfg(...)]` attributes or *any* of the `#[cfg(...)]` attributes present match. This is problematic for several reasons: * It is excessively verbose in certain situations. For example...
RFC 194 RFC 2014-08-09 ~3 min read
doc.rust-lang.org
...The type of the body is `!` which matches the return type. } fn not_diverging() -> ! { // This type is uninhabited. // However, the entire function is not considered diverging. make_empty(); // ERROR: The type of the body is `()` but expected type `!`. } [!NOTE] Divergence can propagate to the surrounding block. See [expr.block.diverging...
The Rust Reference Book 2024-01-01 ~1 min read
github.com
...builder.push("🍣", 7); let mut trie = builder.build(); // exact_match(): Find a word exactly match to query. assert_eq!(trie.exact_match("すし"), Some(&6)); assert_eq!(trie.exact_match("🍣"), Some(&7)); assert_eq!(trie.exact_match("🍜"), None); // Values can be modified. let v = trie.exact_match_mut("🍣").unwrap(); *v...
Crate v0.4.2 2024-05-12
jdrouet.github.io
...Option<AttributeIndex>, filter: &TextFilter, ) -> HashMap<EntryIndex, f64> { let matching_terms = match filter { TextFilter::StartsWith { prefix } => self.trienodes().search(prefix), TextFilter::Matches { value } => self.trigrams().search(value), TextFilter::Equals { value } => self.inner.get_term(value).into_iter(), }; let matching_entries = self.reduce_matches(attribute, matching_terms) self.compute_scores(attribute, matchings...
Rust Walkthroughs 2025-04-16 ~13 min read
doc.rust-lang.org
...For example, match is a keyword. If you try to compile the following function that uses match as its name: Filename: src/main.rs fn match(needle: &str, haystack: &str) -> bool { haystack.contains(needle) } you’ll get this error: error: expected identifier, found keyword `match` --> src/main.rs:4:4...
The Rust Programming Language Book 2024-02-01 ~3 min read
blog.cloudflare.com
...Understanding wildcards Wildcard pattern matching allows users to employ an asterisk (*) in a string to match certain patterns. For example, a single pattern like https://example.com/*/t*st can cover multiple URLs such as https://example.com/en/test, https://example.com/images/toast, and https://example.com/blog...
Project/Tooling Updates 2024-08-28 ~7 min read
github.com
...Specifically, the syntax ```rust ['ident:] while let PAT = EXPR { BODY } ``` desugars to ```rust ['ident:] loop { match EXPR { PAT => BODY, _ => break } } ``` Just as with `if let`, an irrefutable pattern given to `while let` is considered an error. This is largely an artifact of the fact that the desugared `match` ends up...
RFC 214 RFC 2014-08-27 ~2 min read
rust-lang.github.io
...This is a counterpart to if let expressions, and the pattern matching works identically, except that the value from the pattern match is assigned to the surrounding scope rather than the block’s scope. Reference-level explanations let-else is syntactical sugar for match where the non-matched case diverges...
Updates from the Rust Project 2022-09-21 ~20 min read
blog.yoshuawuyts.com
introduction logical and logical or if let-evaluation ordering closing words Introduction One of the things that stands out to me is how similar match and if..else are semantically, while being diverging a fair bit syntactically. The reasons for that seem mostly accidental, and I have a sneaking suspicion...
Observations/Thoughts 2025-04-30 ~10 min read
www.sminez.dev
...x/re/ for each match of re, run the expressions that follow y/re/ between each match of re, run the expressions that follow g/re/ if re matches, run the expressions that follow v/re/ if re does not match, run the expressions that follow For actions, the argument...
Observations/Thoughts 2025-11-19 ~16 min read
crates.io
...To add a literal ] do "[]abc]" {e} = doesn't return a value, but matches end of line. Use this if you don't want to ignore potential extra characters at end of input. Examples: {[0-9ab]} = match 0-9 or a or b {[^,.]} = match anything but , or . {/.../} = return regex inside...
Crate v0.2.6 2021-02-21
"Since it hasn't been said before, there is an important distinction that needs to be addressed. For anyone who has been doing embedded work for any le..."

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.