Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
rust-lang.github.io
...For instance, could we have pub macro_helper_attr! skip in the standard library, namespaced under core::derives or similar? Could we let macros parse that in a way that matches it in a namespaced fashion, so that: • If you write #[core::derives::skip], the macro matches it • If you...
RFC 3698 RFC 2024-09-20 ~9 min read
rust-lang.github.io
...in match patterns is "inclusive". To avoid confusion, we propose to change the match notation to ... to reflect the distinction. The reason to change the notation, rather than the interpretation, is that the exclusive (respectively inclusive) interpretation is the right default for slicing (respectively matching). Rationale for the notation The...
RFC 198 RFC 2014-09-11 ~6 min read
joshitech.blogspot.com
...match unsafe { FILTER.as_ref() } { Some(filter) if !filter.is_match(args.to_string().as_slice()) => return, _ => {} } // Completely remove the local logger from TLS in case anyone attempts to // frob the slot while we're doing the logging. This will destroy any logger // set during logging. let mut logger = LOCAL...
New Projects 2014-12-22 ~2 min read
home.expurple.me
...str> { match db_err { DbErr::Query(RuntimeErr::SqlxError(Error::Database(database_error))) => { let constraint_name = database_error.constraint()?; match database_error.kind() { ErrorKind::UniqueViolation => humanize_unique_violation(constraint_name), ErrorKind::ForeignKeyViolation => humanize_fk_violation(database_error.message()), ErrorKind::CheckViolation => humanize_check_constraint_violation(constraint_name), _ => None, } } // More match arms here...
Observations/Thoughts 2026-04-15 ~2 min read
analog-hors.github.io
...pub fn step(&mut self) { let opcode = self.take_byte_at_pc(); let aaa = (opcode >> 5) & 0b111; let bbb = (opcode >> 2) & 0b111; let cc = opcode & 0b11; match (aaa, bbb, cc) { (8.., _, _) | (_, 8.., _) | (_, _, 4..) => unreachable!(), // match on opcode parts... } } } The main idea was that I'd be able to use different...
Rust Walkthroughs 2023-04-26 ~17 min read
blog.arcjet.com
...In the Result::Ok case it will always return a tuple of strings, where the first string is the remaining text that was not processed, and the second element is the text that was successfully matched by the parser.If it fails to parse then it will return a Result...
Rust Walkthroughs 2024-11-20 ~7 min read
iximiuz.com
...libc::c_int) { println!("[main] What a surprise! Got SIGCHLD!"); match waitpid(Pid::from_raw(-1), None) { Ok(status) => println!("[main] Child exited with status {:?}", status), Err(err) => panic!("[main] waitpid() failed: {}", err), } println!("[main] Bye Bye!"); exit(0); } fn main() { println!("[main] Hi there! My PID is {}.", getpid()); match...
News & Blog Posts 2019-10-22 ~17 min read
adventures.michaelfbryan.com
...To see why this is important, let’s have a look at how many web links there are in some of the books on my computer. # The Rust Programming Language (aka "The Book") $ cd ~/Documents/forks/book $ rg 'http(s?)://' --stats --glob '*.md' --quiet 421 matches 415 matched lines 330...
News & Blog Posts 2020-05-05 ~27 min read
lawngno.me
tl;dr I’ve been comparing crates on crates.io against their upstream repositories in an effect to detect (and, ultimately, help prevent) supply chain attacks like the xz backdoor1, where the code published in a package doesn’t match the code in its repository. The results of these comparisons...
Observations/Thoughts 2024-06-12 ~9 min read
www.sea-ql.org
...non-exhaustive patterns: `&_` not covered | | match table_ref { | ^^^^^^^^^ pattern `&_` not covered |note: `TableRef` defined here | | pub enum TableRef { | ^^^^^^^^^^^^^^^^^ = note: the matched value is of type `&TableRef` = note: `TableRef` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustivelyhelp: ensure that all possible cases are being handled by...
Project/Tooling Updates 2025-09-03 ~11 min read
www.slowtec.de
...Vec<_> = key.split(".").collect(); match deep_lookup(&keys, locale) { Some(res) => res, None => key.to_string(), } } None => key.to_string(), } } } fn deep_lookup(keys: &[&str], map: &Map<String, Value>) -> Option<String> { match &keys { [] => None, [last] => map.get(&last.to_string()).and_then(|x| match x { Value::String(s) => Some(s...
News & Blog Posts 2020-03-03 ~10 min read
newrustacean.com
...Paths and matches and SIMD, cargo new changes, and tons of community-driven learning materials! Audio 0.5⨉ 1⨉ 1.25⨉ 1.5⨉ 1.75⨉ 2⨉ §Show Notes Rust 1.25.0 blog post RFC #1358 – #[repr(align)] RFC #2325 – SIMD stabilization RustConf CFP Hello Rust “Functional and Concurrent Programming...
News & Blog Posts 2018-04-03 ~1 min read
foon.uk
...Actually, this whole match statement is kind of bulky and I had planned to get it working with match and then see if Rust had anything like Scala's Map for Options. Since match is giving us grief, let's just do that now. Guessing: pub fn id_at(state...
Blog Posts 2014-11-10 ~38 min read
rodolfoghi.github.io
...2 Os casos do match também são padrões como if let:1 2 3 4 5 6 7 fn print_number(n: Number) { match n { Number { odd: true, value } => println!("Odd number: {}", value), Number { odd: false, value } => println!("Even number: {}", value), } } // isso imprime o mesmo de antes Variáveis são imutáveis...
Learn Standard Rust 2020-08-11 ~9 min read
willcrichton.net
...tyrade! { enum TList { TNil, TCons(Type, TList) } enum TOption { TNone, TSome(Type) } // Get the Nth item from the list, where Index is either Z or S<N> fn Nth<List, Index>() { match List { TNil => TNone, TCons(X, XS) => match Index { Z => TSome(X), S(IMinusOne) => Nth(XS, IMinusOne) } } } } fn main...
Observations/Thoughts 2021-01-06 ~7 min read
rust-lang.github.io
...Inner attributes Inner attributes can be placed at the top of blocks (and other structure incorporating a block) and apply to that block. { #![attr11] foo() } match bar { #![attr12] _ => {} } // are the same as #[attr11] { foo() } #[attr12] match bar { _ => {} } if Attributes would be disallowed on if for now, because the interaction with...
RFC 16 RFC 2014-03-20 ~4 min read
rustc-dev-guide.rust-lang.org
...Pattern matching match statements for enums with variants that have fields are lowered to TerminatorKind::SwitchInt, too, but the Operand refers to a Place where the discriminant of the value can be found. This often involves reading the discriminant to a new temporary variable. Aggregate construction Aggregate values of any...
Guide to Rustc Development Book 2024-01-01 ~4 min read
siciarz.net
...extern crate libc; use std::c_str::CString; use libc::c_char; #[no_mangle] pub extern "C" fn count_substrings(value: *const c_char, substr: *const c_char) -> i32 { let c_value = unsafe { CString::new(value, false) }; let c_substr = unsafe { CString::new(substr, false) }; match c_value.as_str...
The end of 24 Days of Rust 2014-12-29 ~4 min read
blog.lanesawyer.dev
...And that order is important! When writing patterns, you want to start with the most specific at the top so that it's matched against before its more general version. Since None is a macro metavariable of type expr, putting the second pattern first would mean None matched that more...
Rust Walkthroughs 2021-09-08 ~9 min read
joelmccracken.github.io
2b
...DateTime<Local> = Local::now(); let formatted = local.format("%a, %b %d %Y %I:%M:%S %p\n").to_string(); let bytes = formatted.as_bytes(); let mut f = try!(File::create(filename)); try!(f.write_all(bytes)); Ok(()) } fn main() { match log_time("log.txt") { Ok(..) => println!("File created!"), Err(..) => println...
Notable Links 2015-06-07 ~6 min read
"I gave my company's Embedded C training course this morning. It's amazing how much more sense C makes when you explain it in Rust terms."

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.