Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
siciarz.net
...Time for our first request! extern crate hyper; use hyper::Url; use hyper::client::Request; fn main() { let url = match Url::parse("http://httpbin.org/status/200") { Ok(url) => url, Err(_) => panic!("Uh oh."), }; println!("> get: {}", url); let fresh_request = match Request::get(url) { Ok(request) => request, Err(_) => panic!("Whoops...
Blog Posts 2014-12-08 ~4 min read
arzg.github.io
...u8) { let checkpoint = p.checkpoint(); match p.peek() { Some(SyntaxKind::Number) | Some(SyntaxKind::Ident) => p.bump(), Some(SyntaxKind::Minus) => { let op = PrefixOp::Neg; let ((), right_binding_power) = op.binding_power(); } _ => {} } loop { let op = match p.peek() { Some(SyntaxKind::Plus) => InfixOp::Add, Some(SyntaxKind::Minus) => InfixOp::Sub, Some(SyntaxKind::Star) => InfixOp...
Rust Walkthroughs 2020-11-18 ~6 min read
rust-lang.github.io
...Finally, it is useful for the reader to keep in mind that according to the definitions of this RFC, no simple NT matches the empty fragment, and likewise no token matches the empty fragment of Rust syntax. (Thus, the only NT that can match the empty fragment is a complex...
RFC 550 RFC 2014-12-21 ~21 min read
llogiq.github.io
...if the closing delimiter is on the same line, ignore both if there is only one opening delimiter on that line, the set only contains the horizontal position of the first non-whitespace character of that line otherwise we need to match the position of the first non-whitespace character...
News & Blog Posts 2016-08-30 ~2 min read
willspeak.me
...loop { let mut state = Start; let mut end = start; for c in source[start..].chars() { let next = match state { Start => match c { '(' => Some(Lparen), ')' => Some(Rparen), '0'...'9' => Some(Number), 'a'...'z' => Some(Symbol), c if c.is_whitespace() => Some(Whitespace), _ => None, }, Lparen | Rparen => None, Number => match c { '0'...'9...
News & Blog Posts 2019-07-16 ~10 min read
blog.sheerluck.dev
...match match evaluates one value, called the scrutinee and compares it against a set of patterns fn main() { let number = 2; match number { 1 => println!("One"), 2 => println!("Two"), 3 => println!("Three"), _ => println!("Something else"), } } Each of these lines or sections inside the match block is called an arm, each...
Rust Walkthroughs 2026-09-09 ~19 min read
doc.rust-lang.org
...Values that are matched with wildcards must still be initialized. let x: u8; let c = || { let _ = x; // ERROR: Binding `x` isn't initialized. }; Capturing for discriminant reads If pattern matching reads a discriminant, the place containing that discriminant is captured by ImmBorrow. Matching against a variant of an enum that...
The Rust Reference Book 2024-01-01 ~20 min read
rust-lang.github.io
Summary Add a lifetime specifier for macro_rules! patterns, that matches any valid lifetime. Motivation Certain classes of macros are completely impossible without the ability to pass lifetimes. Specifically, anything that wants to implement a trait from inside of a macro is going to need to deal with lifetimes eventually...
RFC 1590 RFC 2016-04-22 ~1 min read
audunhalland.github.io
...This meant that it wasn't possible to use the matching!-macro on that parameter. The matching macro operates on immutable views of the function inputs, where a single, common lifetime parameter cuts it (because matching only reads things and does not return anything). Given these limitations it became clear...
Project/Tooling Updates 2024-03-27 ~3 min read
radekmie.dev
...At its core, the Matcher class does the heavy lifting and handles all the querying logic, i.e., checking whether a document matches a query.In JavaScript, it’s implemented as a cascade of nested closures, i.e., functions take some information about the query and return a function that...
Observations/Thoughts 2025-07-23 ~7 min read
andreabergia.com
...Just as it should be. 😊 Finding the exception handler Link to heading Finding a matching exception handler is just a question of checking all of them, in order, and stopping with the first one that matches, i.e. whose catch class is a superclass of the actual exception class, since...
Miscellaneous 2023-09-27 ~9 min read
nnethercote.github.io
...impl ::core::cmp::Ord for Point { #[inline] fn cmp(&self, other: &Point) -> ::core::cmp::Ordering { - match *other { - Self { - x: ref __self_1_0, - y: ref __self_1_1, - } => match *self { - Self { - x: ref __self_0_0, - y: ref __self_0_1, - } => match ::core::cmp::Ord::cmp(&(*__self_0_0), &(*__self...
Observations/Thoughts 2022-07-20 ~16 min read
rust-lang.github.io
Summary Add a literal fragment specifier for macro_rules! patterns that matches literal constants: macro_rules! foo { ($l:literal) => ( /* ... */ ); }; Motivation There are a lot of macros out there that take literal constants as arguments (often string constants). For now, most use the expr fragment specifier, which is fine since literal...
RFC 1576 RFC 2016-04-08 ~2 min read
rust-lang.github.io
...Optional match sugar Originally, the RFC included the ability to match the errors caught by a catch by writing catch { .. } match { .. }, which could be translated as follows: • Construct: catch { foo()?.bar() } match { A(a) => baz(a), B(b) => quux(b) } Shallow: match (catch { foo()?.bar() }) { Ok(a) => a, Err(e...
RFC 243 RFC 2014-09-16 ~20 min read
github.com
## Summary [summary]: #summary Currently when using an if let statement and an irrefutable pattern (read always match) is used the compiler complains with an `E0162: irrefutable if-let pattern`. The current state breaks macros who want to accept patterns generically and this RFC proposes changing this error to an error...
RFC 2086 RFC 2017-07-27 ~2 min read
dtrace.org
...For that we’ll use matching, another handy construct. 23 let mut v: Vec<char> = s.chars().collect(); 24 v.sort(); 25 let ss: String = v.into_iter().collect(); 26 27 match dict.get(&ss) { 28 Some(mut v) => v.push(s), 29 _ => { 30 let mut v = Vec::new(); 31...
Tips & Tricks 2015-06-29 ~12 min read
blog.burntsushi.net
...PCRE2 match error: match limit exceeded Aborted (core dumped) The Silver Searcher fails similarly. It reports the first line as a match and neglects the match in the third line. The rest of the search tools benchmarked in this article handle this case without a problem. Literal optimizations Picking a...
News & Blog Posts 2016-09-27 ~92 min read
rust-lang.github.io
...For instance, the following is an erroneous use of the match keyword: fn match(needle: &str, haystack: &str) -> bool { haystack.contains(needle) } error: expected identifier, found keyword `match` --> src/lib.rs:1:4 | 1 | fn match(needle: &str, haystack: &str) -> bool { | ^^^^^ It can instead be written as fn r#match...
RFC 2151 RFC 2017-09-14 ~4 min read
rust-analyzer.github.io
#5821 Remove Unused Parameter refactoring. #5695 completion for unstable features. #5643 Add new consuming modifier to semantic syntax highlighting, apply consuming and mutable to methods. #5758 structural search replace now inserts *, & and &mut in the replacement to match any auto[de]ref in the matched code. #5682 allow disabling specific...
Tooling 2020-08-26 ~1 min read
lucumr.pocoo.org
...impl error::Error for LibError { fn description(&self) -> &str { match *self { BadStatusCode => "bad status code", IoError(err) => "encountered an I/O error", } } fn detail(&self) -> Option<String> { match *self { BadStatusCode(code) => Some(format!("status code was {}", code)), _ => None, } } fn cause(&self) -> Option<&error::Error> { match *self { IoError(ref err) => Some...
Blog Posts 2014-11-10 ~12 min read
"When your Rust build times get slower after adding some procedural macros: We call that the syn tax 🦀"

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.