Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
github.com
...expected identifier, found keyword `match` --> src/lib.rs:1:4 | 1 | fn match(needle: &str, haystack: &str) -> bool { | ^^^^^ ``` It can instead be written as `fn r#match(needle: &str, haystack: &str)`, using the `r#match` raw identifier, and the compiler will accept this as a true `match` function. Generally when...
RFC 2151 RFC 2017-09-14 ~5 min read
docs.rs
...112,578 ns/iter (+/- 11,778) test match_u8::application_zip ... bench: 222 ns/iter (+/- 144) test match_u8::image_gif ... bench: 140 ns/iter (+/- 14) test match_u8::image_png ... bench: 139 ns/iter (+/- 18) test match_u8::text_plain ... bench: 44 ns/iter (+/- 3) However, it should be...
Crate v3.2.2 2025-11-14
blog.veeso.dev
...Alice }, _ => panic!("Unknown user"),}; This would result in an error, because the type of user canàt be determined error[E0308]: `match` arms have incompatible types --> src/main.rs:36:20 |34 | let user = match name { | ________________-35 | | "carlo" => User { greet: Carlo }, | | --------------------- this is found to be of type `User<Carlo>`36...
Observations/Thoughts 2024-10-30 ~5 min read
nbaksalyar.github.io
...fn read(&mut self) { match self.state { ClientState::AwaitingHandshake => { self.read_handshake(); }, _ => {} } } It’s simple - we match on the current value of self.state, and for now we handle only AwaitingHandshake and a match-all case (which is required by the Rust compiler, as the patterns in match should be...
News & Blog Posts 2015-11-16 ~32 min read
rust-analyzer.github.io
...substitute variables in config.serverPath. #13981 don’t run flycheck on startup unless checkOnSave is enabled. #13966 don’t compute layout if TargetDataLayout is not available. #13971 improve inference for binary operations more precise. #13961 don’t generate PartialEq/PartialOrd methods body when types don’t match. #13984 fix target...
Project/Tooling Updates 2023-01-25 ~1 min read
system.joekain.com
...FnMut(&TrapInferior, TrapBreakpoint), { - let inferior = inf.pid; let bp = - find_breakpoint_matching_inferior_instruction_pointer(&inf) + find_breakpoint_matching_inferior_instruction_pointer(inferior) .expect("Could not find breakpoint"); - match inf.state { + match inferior.state { InferiorState::Running => (), _ => panic!("Unhandled error in breakpoint::handle"), } callback(inferior, bp.target_address); step_over(inferior...
Observations/Thoughts 2025-08-20 ~33 min read
saidvandeklundert.net
...That Matching enum variants Using the match keyword, we can do pattern matching on enums. The following function takes the Example enum as an argument: fn matcher(x: Example) { match x { Example::This => println!("We got This."), Example::That => println!("We got That."), } } We can pass the matcher function a...
Rust Walkthroughs 2021-09-01 ~19 min read
hemomorphic.alexblood.net
...Explicit match The next best way to handle the Result variants, is to match them. This may well be the best solution, depending on the context: let value = match divisible_by_two(3) { Ok(value) => value, Err(err) => { // do something with the error like default to 0 println!("{err}"); 0...
Rust Walkthroughs 2026-05-27 ~13 min read
arianfarid.me
...For example, if we represent the code "S" ("G" or "C") as 0101, rotating two bits will still give us 0101.Nucleotide Encoding ​Let's first look at a simple match expression to see the final schema we have derived. This match expressions encodes each IUPAC nucleotide into a 4...
Rust Walkthroughs 2025-06-25 ~7 min read
doc.rust-lang.org
pub const fn eq_ignore_ascii_case(&self, other: &char) -> bool
char::eq_ignore_ascii_case — Checks that two values are an ASCII case-insensitive match. Equivalent to to_ascii_lowercase(a) == to_ascii_lowercase(b). Examples let upper_a = 'A'; let lower_a = 'a'; let lower_z = 'z'; assert!(upper_a.eq_ignore_ascii_case(&lower_a)); assert!(upper_a...
method core Stable since 1.23.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct RSplitMut<'a, T, P>
RSplitMut — An iterator over the subslices of the vector which are separated by elements that match pred, starting from the end of the slice. This struct is created by the rsplit_mut method on slices. Example let mut slice = [11, 22, 33, 0, 44, 55]; let iter = slice.rsplit_mut...
struct core Stable since 1.27.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn eq_ignore_ascii_case<S>(&self, other: S) -> bool
OsStr::eq_ignore_ascii_case — Checks that two strings are an ASCII case-insensitive match. Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), but without allocating and copying temporaries. Examples use std::ffi::OsString; assert!(OsString::from("Ferris").eq_ignore_ascii_case("FERRIS")); assert!(OsString::from("Ferrös").eq...
method std Stable since 1.53.0 Version 1.100.0-nightly
rust-analyzer.github.io
#12937 (first contribution) implement syntax fix-up for match and for loops. #13010 actually call rustc from the RUSTC_WRAPPER when run by build scripts (fixes feature detection for anyhow). #12942 make concat! work with characters. #12990 improve whitespace insertion in macro-expansion. #12992 infer byte string pattern as &[u8...
Project/Tooling Updates 2022-08-17 ~1 min read
codeandbitters.com
...How do I tell which git commit matches the published crate? Is there any guarantee that the published crate source matches the git source? What kinds of best practices exist? Is there room for improvement? Why do I care about these things? There are a few reasons, but mostly this...
Observations/Thoughts 2021-10-06 ~11 min read
www.joshmcguigan.com
...Serializer, { let mut serde_state = match Serializer::serialize_struct( serializer, "Point", false as usize + 1 + 1, ) { serde::export::Ok(val) => val, serde::export::Err(err) => { return serde::export::Err(err); } }; match SerializeStruct::serialize_field(&mut serde_state, "x", &self.x) { serde::export::Ok(val) => val, serde::export::Err(err) => { return...
News & Blog Posts 2019-11-19 ~11 min read
github.com
...Checks for exhaustiveness work identically to matches on structures with named fields. For instance, if the above match omitted the last case, it would receive a warning for a non-exhaustive match. A pattern must include a `..` if it does not match all fields, other than union fields for which...
RFC 2102 RFC 2017-08-05 ~18 min read
doc.rust-lang.org
...No element was found These cases can either be explicitly handled via match or implicitly with unwrap. Implicit handling will either return the inner element or panic. Note that it's possible to manually customize panic with expect, but unwrap otherwise leaves us with a less meaningful output than explicit...
Rust by Example Book 2024-01-01 ~1 min read
corrode.dev
...If we use slice pattern matching instead, we’ll only get access to the element if the correct match arm is executed. match matching_users.as_slice() { [] => todo!("What to do if no users found!?"), [existing_user] => { // Safe! Compiler guarantees exactly one element // No need to index into the vector...
Observations/Thoughts 2025-11-05 ~16 min read
ideas.reify.ing
...Pin<&mut _> = this.stream; match stream.poll_next(cx) { Poll::Ready(response) => { match response { None => Poll::Ready(None), // end of the stream Some(result) => match result { Ok(event) => match event { Event::Open => unreachable!(), // it has been filtered out Event::Message(message) => { if message.data == "[DONE]" { Poll::Ready(None) // end of...
Project/Tooling Updates 2024-04-17 ~6 min read
doc.rust-lang.org
pub struct RSplitNMut<'a, T, P>
RSplitNMut — An iterator over subslices separated by elements that match a predicate function, limited to a given number of splits, starting from the end of the slice. This struct is created by the rsplitn_mut method on slices. Example let mut slice = [10, 40, 30, 20, 60, 50]; let iter...
struct core Stable since 1.0.0 Version 1.100.0-nightly

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.