Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
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
git-cliff.org
...id message body author.name author.email committer.email committer.name Glob -> Regex 🧶​ [git].tag_pattern was only supporting glob patterns for matching (mostly due to the underlying support of such glob by git2), now it directly supports regular expressions: [git]- # glob pattern for matching git tags+ # regex for...
Project/Tooling Updates 2023-11-01 ~2 min read
blog.yoshuawuyts.com
...What if the compiler actually used this information in the function body too? That would mean matching on self would only need to account for the possible cases rather than all cases: match self { Self::Orange => {} Self::Flashing => {} // no other cases need matching! } This isn't particularly relevant yet for...
Observations/Thoughts 2022-08-24 ~20 min read
doc.rust-lang.org
...file in write-only mode, returns `io::Result<File>` let mut file = match File::create(&path) { Err(why) => panic!("couldn't create {}: {}", display, why), Ok(file) => file, }; // Write the `LOREM_IPSUM` string to `file`, returns `io::Result<()>` match file.write_all(LOREM_IPSUM.as_bytes()) { Err(why) => panic!("couldn't...
Rust by Example Book 2024-01-01 ~1 min read
github.com
...a hypothetical `#[cold]` attribute that indicates a branch is unlikely), one can annotate `match` arms: ```rust match cond { #[attr] true => { ... } #[attr] false => { ... } } ``` ## Drawbacks This starts mixing attributes with nearly arbitrary code, possibly dramatically restricting syntactic changes related to them, for example, there was some consideration for using `@` for attributes, this...
RFC 16 RFC 2014-03-20 ~4 min read
dev.to
...How do you get the value inside? How do you decide what to do based on the outcome of the operation? The answer to both questions lies in pattern matching. fn read_state(file: Result<i32,&str>) { match file { Ok(answer) => println!("Extracted from file {}", answer), Err() => println!("Bitter disappointment...
Learn Simple Rust 2020-10-21 ~4 min read
mmapped.blog
mmap(blog) Posts About Atom Feed ✏ 2023-02-14 ✂ 2023-02-16 Introduction Objects, values, and references When abstraction hurts Common expression elimination Monomorphism restriction Functional abstraction Newtype abstraction Views and bundles When composition hurts Object composition Pattern matching cannot see through boxes Orphan rules Fearless concurrency is a lie...
Observations/Thoughts 2023-03-01 ~20 min read
crates.io
...LanguageTag = "en-x-twain".parse().unwrap(); assert_eq!(langtag.primary_language(), "en"); assert_eq!(Vec::from_iter(langtag.private_use_subtags()), vec!["twain"]); You can check for equality, but more often you should test if two tags match. In this example we check if the resource in German language is...
Crate v0.3.2 2021-05-24
blog.yoshuawuyts.com
...But otherwise the logic is the same for both: // `match` consumes a concrete `Result` type match foo() { Ok(x) => { .. } Err(err) => { .. } } // `match` consumes an abstract `impl Try` type // NOTE: this should probably become a combinator on `Try` let res = match foo().branch() { Break(b) => FromResidual::from_residual(b), Continue(c...
Observations/Thoughts 2025-12-24 ~11 min read
blog.yoshuawuyts.com
...create and return an error if the condition doesn't match ensure_eq!: create and return an error if two expressions don't match ensure_ne!: create and return an error if two expressions match bail is kind of like panic, and ensure is kind of like assert. You can...
Rust Walkthroughs 2023-01-25 ~4 min read
docs.rs
...u32) -> u32 { match n { 0 | 1 => 1, _ => fib(n-1).await + fib(n-2).await } } The compiler helpfully tells us that: error[E0733]: recursion in an `async fn` requires boxing --> src/main.rs:1:26 | 1 | async fn fib(n : u32) -> u32 { | ^^^ recursive `async fn` | = note: a recursive `async fn...
Crate v1.1.1 2024-04-25
 What's New in the Rust 2024 Edition
1:13:35
Rustacean Station rustacean-station.org
...hello@rustacean-station.org Timestamps & referenced resources [@03:05] - RPIT lifetime capture rules [@08:00] - let chains in if and while if let temporary scope Mara’s post on “super let” Tail expression temporary scope [@19:15] - Match ergonomics reservations [@24:49] - Unsafe extern blocks [@29:15] - Unsafe attributes...
Podcast 2026-01-23 1:13:35
docs.rs
...assert_eq!(queue.pop(), None); // There are Entry API if you want to avoid double hash lookups match queue.entry("Entry"){ Entry::Vacant(entry)=>entry.set_priority(10), Entry::Occupied(_)=>unreachable!(), }; match queue.entry("Entry"){ Entry::Vacant(_)=>unreachable!(), Entry::Occupied(entry)=>{ assert_eq!(entry.get_key(), &"Entry"); assert_eq!(entry...
Crate v0.4.2 2023-11-15
blog.meilisearch.com
...frequency matching strategy Meilisearch 1.9 introduces a new matching strategy to prioritize results that contain occurrences of the least frequent query terms. When using the frequency matching strategy, Meilisearch will deprioritize very common words. Let’s take the example of the "the little prince" query. In our indexed documents...
Project/Tooling Updates 2024-07-03 ~4 min read
blog.turbo.fish
...use syn::{Lit, NestedMeta}; let nested = match meta_list.nested.len() { // `#[getter()]` without any arguments is a no-op 0 => return Ok(None), 1 => &meta_list.nested[0], _ => { return Err(syn::Error::new_spanned( meta_list.nested, "currently only a single getter attribute is supported", )); } }; let name_value = match nested...
Rust Walkthroughs 2021-05-12 ~6 min read
github.com
...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
rapha.land
...Add a new variant later and every match site that doesn’t cover it stops compiling, with the type checker pointing at the exact line. That is the safety property pattern matching is for. Match also works as an expression: const name: []u8 = match (color) { Color.Red { "red" } Color.Green...
Project/Tooling Updates 2026-07-08 ~26 min read
github.com
...examples/matching.rs includes matching.go by Stefan Nilsson, licensed under Creative Commons Attribution 3.0 Unported License. tests/mpsc.rs includes modifications of code from The Rust Programming Language, licensed under the MIT License and the Apache License, Version 2.0. tests/golang.rs is based on code from...
Crate v0.5.16 2026-07-06
crates.io
...How to get a compatible version of protoc The protoc binary that you use to generate code needs to have a version that exactly matches the version of the protobuf crate you are using. More specifically, if you are using Rust protobuf x.y.z then you need to use...
Crate v4.36.0-rc.2 2026-08-03
"Indeed. I notice even when after some Rust I return to the “main day job” C, I start to think differently, and it is excellent. Rust is like a com..."

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.