Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
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
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
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
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
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
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
ricardoanderegg.com
...usize = if ctx.len() <= arg_cap_group { // no capture group, use default 0 } else { ctx.get(arg_cap_group).context("capture group")? }; // let mut caploc = re.capture_locations(); // re.captures_read(&mut caploc, input_value); if let Some(cap) = re.captures(input_value) { match cap.get(cap_group) { None => empty...
Rust Walkthroughs 2022-05-18 ~10 min read
www.halcyon.hr
...There are several different ways to do this - and it all depends on what you want to do.Pattern matching errorsA simple way of figuring out what’s going on is to use pattern matching on the result type.match how_many_bananas(0) { Ok(number) => println!("You have {} bananas...
News & Blog Posts 2020-06-16 ~13 min read
www.hoverbear.org
...num_read]) .unwrap(); if let Ok(rpc) = json::decode::<RemoteProcedureCall<T>>(data) { match rpc { RemoteProcedureCall::RequestVote(call) => self.handle_request_vote(call, source), RemoteProcedureCall::AppendEntries(call) => self.handle_append_entries(call, source), } } else if let Ok(rpr) = json::decode::<RemoteProcedureResponse>(data) { match rpr { RemoteProcedureResponse::Accepted { .. } => self.handle_accepted(rpr, source...
Blog Posts 2015-02-09 ~5 min read
dev.to
...Uuid) -> ApiResponse { let mut v = userdb.db.lock().unwrap(); let users = &mut *v; let pos = users.iter().position(|x| x.id.to_string() == id.to_string()); match pos { Some(p) => { if v[p].match_password(&user.password) { match &user.new_password { Some(passw) => { v[p].update_password(&passw); ApiResponse::ok...
Rust Walkthroughs 2020-11-18 ~18 min read
relm4.org
...1 2 3 4 5 6 7 8 9 10 11 let component = MyComponent::builder() // Start the component service with an initial parameter .launch("Hello world") // Attach the returned receiver's messages to this closure. .connect_receiver(move |sender, message| match message { // Transform and forward the message Output::HelloThere => { sender...
Project/Tooling Updates 2022-07-27 ~5 min read
ruudvanasseldonk.com
...The implementation is a big match statement. For example, this is the check for an if-else expression:let expr_type = match expr { Expr::IfThenElse { condition_span, condition, body_then, body_else, span_then, span_else, .. } => { self.check_expr(type_bool_condition(), *condition_span, condition)?; let type_then = self.check...
Observations/Thoughts 2024-07-24 ~15 min read
doc.rust-lang.org
...Result<i32, ParseIntError>) { match result { Ok(n) => println!("n is {}", n), Err(e) => println!("Error: {}", e), } } fn main() { print(multiply("10", "2")); print(multiply("t", "2")); } The try! macro Before there was ?, the same functionality was achieved with the try! macro. The ? operator is now recommended, but you may still...
Rust by Example Book 2024-01-01 ~1 min read
"I’ve said it before and I’ll say it again: as a child of OCaml and C++, Rust currently is the best language for production compiler-shaped things."

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.