Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
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
 What's New in the Rust 2024 Edition
1:13:35
Rustacean Station rustacean-station.org
...Right? You can say, oh, like, if is, like, if is a can be compiled to a match. I can transform this if into a match and then just write the code for the match once and generate code for a match. And you see this with, like, you know...
Podcast 2026-01-23 1:13:35
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
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
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
arXiv arxiv.org
...A Rust macro-and-match dispatch layer keeps a single, backend-agnostic call site while emitting vendor-specific kernel strategies, and the type system enforces buffer-size and lifetime correctness at compile time. On a two-socket AMD Instinct MI210 node we measure GPU speedups from $1.03\times$ (bandwidth...
Distributed Computing Ianna Osborne, Maxym Naumchyk, Tai Sakuma et al. 2026-09-21 arXiv:2609.24628
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
rust-lang.github.io
...Rc<[Wrap]> = Rc::from(arr.as_ref()); /// assert_eq!(rc.as_ref(), &arr); // The elements match. /// assert_eq!(rc.len(), arr.len()); // The lengths match. /// ``` /// /// Using the [`Into`][Into] trait: /// /// ``` /// #![feature(shared_from_slice)] /// use std::rc::Rc; /// /// #[derive(PartialEq, Clone, Debug)] /// struct Wrap(u8); /// /// let rc: Rc<[Wrap]> = arr...
RFC 1845 RFC 2017-01-05 ~12 min read
rapha.land Archived: primary link replaced with an archive on 2026-10-09T10:11:12.565Z (UTC; replacement date, not snapshot date)
...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
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
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
...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
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.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
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
amanjeev.com
...non-exhaustive patterns: `&_` not covered --> src/main.rs:12:11 | 12 | match place { | ^^^^^ pattern `&_` 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 `&str`I do not enjoy writing tests and eating my...
Observations/Thoughts 2020-09-16 ~13 min read
docs.rs
Procedural macro for html5ever.
Crate v0.35.0 2025-07-02
"So long, and thanks for all the turbofish."

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.