Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
rust-lang.github.io
...maybe_label FOR top_pat IN expr_nostruct block ; For match expressions we now have: 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 | block...
RFC 2535 RFC 2018-08-29 ~18 min read
gaultier.github.io
...But not for match. Alright, so after some searching around, I came up with this mouthful of a syntax: Rust1 let value = match left.try_into() { 2 Ok(v) => v, 3 Err::<_, TryFromSliceError>(err) => { 4 // [...] 5 } 6 }; Which works! And the same syntax can be applied to the Ok branch...
Rust Walkthroughs 2025-02-12 ~5 min read
adventures.michaelfbryan.com
...Matcher> Matcher for FallingEdge<M> { fn matches_event(&mut self, event: &Event<'_>) -> bool { let current_is_matched = self.inner.matches_event(event); let is_falling_edge = self.previous_was_matched && !current_is_matched; self.previous_was_matched = current_is_matched; is_falling_edge } } For convenience we can add a combinator...
News & Blog Posts 2020-02-11 ~14 min read
beeb.li
...For each match, we see a couple of lines of context with line numbers above and below. The selected match is indicated by a yellow chevron in the gutter. Each individual match can be toggled to be skipped during replacement with s. The match appears in dimmed text if skipped...
Project/Tooling Updates 2026-05-20 ~16 min read
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
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
rust-lang.github.io
...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
rust-lang.github.io
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
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
...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
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
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
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
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
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...
RFC 3137 RFC 2021-05-31 ~20 min read
rust-lang.github.io
...Specifically, the syntax ['ident:] while let PAT = EXPR { BODY } desugars to ['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 with an...
RFC 214 RFC 2014-08-27 ~2 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
"We put in a lot of work to make upgrades painless; for example, we run a tool (called “crater”) before each Rust release that downloads every pack..."

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.