Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
...f64) -> f64 { // This is a three level match pyramid! match checked::div(x, y) { Err(why) => panic!("{:?}", why), Ok(ratio) => match checked::ln(ratio) { Err(why) => panic!("{:?}", why), Ok(ln) => match checked::sqrt(ln) { Err(why) => panic!("{:?}", why), Ok(sqrt) => sqrt, }, }, } } fn main() { // Will this fail? println!("{}", op(1.0...
Rust by Example Book 2024-01-01 ~1 min read
smallcultfollowing.com
...The innermost expression that encloses both of these expressions is the match itself (as depicted above), and hence the borrow is considered to extend until the end of the match. Unfortunately, the match encloses not only the Some branch, but also the None branch, and hence when we go to...
News & Blog Posts 2016-05-09 ~9 min read
doc.rust-lang.org
tuples Tuples can be destructured in a match as follows: fn main() { let triple = (0, -2, 3); // TODO ^ Try different values for `triple` println!("Tell me about {:?}", triple); // Match can be used to destructure a tuple match triple { // Destructure the second and third elements (0, y, z) => println!("First is...
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
...fn main() { match a { _ => // comment with => { println!("A") } } } Style edition 2024: fn main() { match a { _ => // comment with => { println!("A") } } } Multiple inner attributes in a match expression indented incorrectly Multiple inner attributes in a match expression were being indented incorrectly. Style edition 2021: pub fn main() { match a { #![attr1] #![attr2] _ => None...
The Rust Edition Guide Book 2024-01-01 ~7 min read
niedzejkob.p4.team
...non-exhaustive patterns: `(Some(_), Some(_))` not covered --> example.rs:4:11 | 4 | match (old_thing, new_thing) { | ^^^^^^^^^^^^^^^^^^^^^^ pattern `(Some(_), Some(_))` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = note: the matched value is of type `(Option<Thing>, Option<Thing...
Observations/Thoughts 2021-07-21 ~8 min read
docs.rs
...For full details read the docs on docs.rs This crate provides helper types for matching against enum variants, and extracting bindings to each of the fields in the deriving Struct or Enum in a generic way. If you are writing a #[derive] which needs to perform some operation on...
Crate v0.14.0 2026-07-30
rust-lang.github.io
...target, which matches the entire target triple string (e.g. arm-unknown-linux-gnueabihf). This also adds a CARGO_CFG_TARGET environment variable for parity with other CARGO_CFG_* variables. In addition, this proposes a shorthand cfg(target(...)) to match multiple components of a target string at once. Motivation To...
RFC 3239 RFC 2020-09-27 ~2 min read
rustc-dev-guide.rust-lang.org
...This means that matching on TyKind can easily be incorrect. We handle normalization in two different ways. When proving Trait goals when normalizing associated types, we separately assemble candidates depending on whether they structurally match the self type. Candidates which match on the self type are handled in EvalCtxt::assemble...
Guide to Rustc Development Book 2024-01-01 ~2 min read
doc.rust-lang.org
use
...let role = Student; match stage { // Note the lack of scoping because of the explicit `use` above. Beginner => println!("Beginners are starting their learning journey!"), Advanced => println!("Advanced learners are mastering their subjects..."), } match role { // Note again the lack of scoping. Student => println!("Students are acquiring knowledge!"), Teacher => println!("Teachers are...
Rust by Example Book 2024-01-01 ~1 min read
docs.rs
...String) -> Result<i32, exitcode::ExitCode> { match s.parse::<i32>() { Ok(i) => Ok(i), Err(_) => Err(exitcode::USAGE) } } pub fn main() { match parse_int_or_return_error_exitcode("123".to_string()) { Ok(i) => println!("Parsed: {}", i), Err(code) => { println!("Parse error. Exiting with code: {}", code); process::exit(code); } } match parse_int...
Crate v1.1.2 2017-06-18
docs.rs
...let status = reqwest::get(format!("{}/missing", &mock_server.uri())) .await .unwrap() .status(); assert_eq!(status.as_u16(), 404); } Matchers wiremock provides a set of matching strategies out of the box - check the matchers module for a complete list. You can define your own matchers using the Match trait, as well...
Crate v0.6.5 2025-08-24
www.youtube.com
...Um meaning that we're matching um sorry this isn't the same one. Um this one is uh domain names. So it matches it's a not perfect domain names but it matches dashes and then alpha numeric and then it has one or more sets with a dot...
Video 2026-01-06
mrtact.medium.com
...The clunkiness of having to match everything against a Result, only to then re-wrap each output in the correct variant, completely obscures the beauty of that match expression. I mean, seriously, look at it! Not blowing my own horn — I didn’t have to be all that smart to...
Rust Walkthroughs 2021-01-20 ~3 min read
doc.rust-lang.org
...Condition operands must be either an [Expression] with a boolean type or a conditional let match. If all of the condition operands evaluate to true and all of the let patterns successfully match their scrutinees, the consequent block is executed and any subsequent else if or else block is skipped...
The Rust Reference Book 2024-01-01 ~4 min read
rust-analyzer.github.io
#10519 (first contribution) set toolinfo in LSIF export. #10522 (first contribution) fix serialization of SignatureHelp response. #10534 (first contribution) improve logo rendering on dark backgrounds. #10538 (first contribution) make brace matching prefer the one to the right of the cursor. #10542 (first contribution) use workspace cargo to fetch rust-src...
Project/Tooling Updates 2021-10-20 ~1 min read
www.jacobelder.com
← Back to all posts One of the things I really like about Rust is its match expressions. Plenty of other languages like Ruby, Python, and Haskell have similar features, but it’s painfully absent in popular languages like JavaScript. There, we have only switch...case. That statement is not exhaustive...
Rust Walkthroughs 2024-02-28 ~7 min read
crates.io
...The actual results will vary depending on the inputs, but here is a taster based on "a".repeat(40) as an input and various modes (nothing matched, everything matched and replaced, everything matched from the start and deleted): params .replace (ns) .cow_replace (ns) difference (%) ("a", "") 408.59 290.27...
Crate v0.1.3 2023-09-26
blog.pnkfx.org
...use of moved value: `matches` --> src/lib.rs:11:36 | 8 | fn print_count(matches: Matches, opts: Options) { | ------- move occurs because `matches` has type `Matches`, which does not implement the `Copy` trait 9 | match opts.max { 10 | Some(n) if matches.count() > n => print!("{}{}", n, opts.separator), | ------- value moved here...
News & Blog Posts 2019-07-02 ~33 min read
kerkour.com
...u64) { let timeout = Duration::from_secs(timeout); let socket_address = SocketAddr::new(target.clone(), port); match tokio::time::timeout(timeout, TcpStream::connect(&socket_address)).await { Ok(Ok(_)) => println!("{}", port), _ => {} } } Extreme concurrency If you are a recurrent reader of this blog you should have guessed the perfect concurrency primitive for the...
Rust Walkthroughs 2021-08-18 ~3 min read
docs.rs
...BuildMetadata::EMPTY, }; assert!(!req.matches(&version)); // Check whether it matches 1.3.0 (yes it does) let version = Version::parse("1.3.0").unwrap(); assert!(req.matches(&version)); } Scope of this crate Besides Cargo, several other package ecosystems and package managers for other languages also use SemVer: RubyGems/Bundler for...
Crate v1.0.28 2026-04-04
"scott: see, at christmas, if I unwrap() my present and I find that it's empty, I immediately have a panic attack and everyone gets really freaked out...."
— in #rust-offtopic.

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.