Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
blog.spike.codes
...let if_else_regex = Regex::new(r"\{% if (.*?) %\}((.|\n)*?)(\{% else %\}((.|\n)*?)\{% endif %\}|\{% endif %\})").unwrap(); RegEx Breakdown {% if — Match first part of opening tag (.*?) — Match any text lazily %} — Match end part of opening tag ((.|\n)*?) — Match multi-line string of text lazily {% else %} — Match else tag ((.|\n)*?) — Match multi-line string...
Rust Walkthroughs 2022-06-22 ~11 min read
osa1.net
...previous borrow of `*self` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `*self` until the borrow ends <anon>:16 match self.find_thing_mut(name) { ^~~~ <anon>:24:10: 24:10 note: previous borrow ends here <anon>:16 match self.find_thing_mut(name) { ... <anon>:24 } ^ <anon...
News & Blog Posts 2016-04-04 ~7 min read
request-for-explanation.github.io
Episode List June 19, 2017 This week we look at RFC 2005 "Match Ergonomics Using Default Binding Modes" MP3 OGG MPEG-4 RFC 1944, the predecessor of #2005 Carol Nichols Alexis Beingessner Manish Goregaokar Transcription courtesy of wirelyre! Thank you! <3 Carol Nichols: Hi everyone. Welcome to the inaugural episode...
News & Blog Posts 2017-06-27 ~14 min read
ntietz.com
...The struct tells us where a match is. Our first function finds our longest partial match that's within our digit limit. pub struct Location { pub offset: usize, pub length: usize, } pub fn find_pi_match(msg: &[u8], limit: usize) -> Option<Location> { let mut best_match: Option<Location> = None; let...
Observations/Thoughts 2024-03-20 ~6 min read
blog.burntsushi.net
...Instead, they have leftmost-longest semantics, where the longest possible match always wins. In this case, | is a commutative operator. Some other regex engines, such as Hyperscan, implement “report all matches” or “earliest match” semantics. In that case, abc|a would match both a and abc in the haystack abc...
Project/Tooling Updates 2023-07-12 ~105 min read
github.com
...pub enum Equality { AreEqual, AreUnequal, } pub trait PartialEq { fn partial_eq(&self, other: &Self) -> Option<Equality>; fn eq(&self, other: &Self) -> bool { match self.partial_eq(other) { Some(AreEqual) => true, _ => false, } } fn neq(&self, other: &Self) -> bool { match self.partial_eq(other) { Some(AreUnequal) => true, _ => false, } } } ```
RFC 100 RFC 2014-06-01 ~2 min read
hurl.dev
...GET https://sample.org/hello HTTP/1.0 200 [Asserts] jsonpath "$.date" matches "^\\d{4}-\\d{2}-\\d{2}$" jsonpath "$.name" matches "Hello [a-zA-Z]+!" In 1.6.0, we’ve added regex literal for matches: GET https://sample.org/hello HTTP/1.0 200 [Asserts] jsonpath "$.date" matches...
Project/Tooling Updates 2022-02-23 ~1 min read
blog.sheerluck.dev
...Match match is Rust's pattern matching construct. It compares a value against a series of patterns and executes the code for the first pattern that matches: let x = 3; match x { 1 => println!("one"), 2 => println!("two"), 3 => println!("three"), 4 => println!("four"), _ => println!("other") } Each line inside the...
Rust Walkthroughs 2026-04-08 ~18 min read
heroiclabs.com
...Any user can participate in matches with other users. Users can create, join, and leave matches with messages sent from clients. A match exists on the server until its last participant has left. Any data sent through a match is immediately routed to all other participants. The matches are kept...
Rust Walkthroughs 2021-04-21 ~19 min read
www.newrustacean.com
...Pattern matching, with a focus on using them with enumerated types and some discussion about how they differ from switch blocks in C-like languages. Using the Option and Result enumerated types with pattern matching to provide meaningful returns from functions safely. §Order There is a specific order to the...
News & Blog Posts 2015-10-26 ~1 min read
adventures.michaelfbryan.com
...The error message is telling us that it matched the function signature, then when trying to match the rest of the input (of which there is none) it didn’t have enough tokens. The solution is easy enough, just add a base case which matches exactly nothing. // src/lib.rs...
News & Blog Posts 2020-06-23 ~29 min read
doc.rust-lang.org
...Option<Food>) -> Option<Peeled> { match food { Some(food) => Some(Peeled(food)), None => None, } } // Chopping food. If there isn't any, then return `None`. // Otherwise, return the chopped food. fn chop(peeled: Option<Peeled>) -> Option<Chopped> { match peeled { Some(Peeled(food)) => Some(Chopped(food)), None => None, } } // Cooking food. Here, we showcase...
Rust by Example Book 2024-01-01 ~1 min read
www.howtocodeit.com
...The underscores are matched by $skip, and the expression is matched by $e. Let's break this down.Private macro rules in Rust@ {...} isn't some esoteric Rust syntax you haven't seen before. It's not valid Rust at all! It's merely a pattern of tokens, matched by...
Rust Walkthroughs 2024-07-10 ~16 min read
rustc-dev-guide.rust-lang.org
...If there are multiple matching candidates in a group, we report an error, except that multiple impls of the same trait are treated as a single match. Otherwise we pick the first match we find. In the case of our example, the first step is Rc<Box<[T; 3]>>, which...
Guide to Rustc Development Book 2024-01-01 ~3 min read
doc.rust-lang.org
...use std::num::ParseIntError; fn multiply(first_number_str: &str, second_number_str: &str) -> Result<i32, ParseIntError> { let first_number = match first_number_str.parse::<i32>() { Ok(first_number) => first_number, Err(e) => return Err(e), }; let second_number = match second_number_str.parse::<i32>() { Ok(second_number) => second_number...
Rust by Example Book 2024-01-01 ~1 min read
vojtechkral.github.io
...fn exprs() { fn make_token(s: &'static str) -> Result<Token, ()> { Ok(Token(s)) } match make_token("matched token") { Ok(_) => println!("match arm"), Err(_) => unreachable!(), } println!("after match"); if let Ok(_) = make_token("if let token") { println!("if let body"); } println!("after if let"); if make_token("if token").is_ok...
Observations/Thoughts 2020-09-30 ~7 min read
fast.github.io
...fn parse_value_iterative(tokens: &mut TokenStream) -> JsonValue { let mut stack = vec![ParseState::ParseValue]; let mut results = Vec::new(); while let Some(state) = stack.pop() { match state { ParseState::ParseValue => { match tokens.peek() { Token::LeftBrace => { stack.push(ParseState::ParseObject(HashMap::new())); } Token::LeftBracket => { stack.push(ParseState::ParseArray(Vec::new())); } _ => { results.push...
Project/Tooling Updates 2025-07-23 ~4 min read
doc.rust-lang.org
...Since pattern matching is like reading the union with a particular field, it has to be placed in unsafe blocks as well. # union MyUnion { f1: u32, f2: f32 } # fn f(u: MyUnion) { unsafe { match u { MyUnion { f1: 10 } => { println!("ten"); } MyUnion { f2 } => { println!("{}", f2); } } } } Pattern matching may match a union...
The Rust Reference Book 2024-01-01 ~4 min read
doc.rust-lang.org
...Finally, it is useful for the reader to keep in mind that according to the definitions of this formalism, no simple NT matches the empty fragment, and likewise no token matches the empty fragment of Rust syntax. (Thus, the only NT that can match the empty fragment is a complex...
The Rust Reference Book 2024-01-01 ~13 min read
anoopelias.github.io
...Sample code below,macro_rules! assert_match { ($exp:expr, $pattern1:pat_param | $pattern2:pat) => { match $exp { $pattern1 => { println!("Pattern 1 match"); } $pattern2 => { println!("Pattern 2 match"); } _ => panic!("Failed match"), } } } fn main() { let value = 2; assert_match!(value, 1 | 2); } metaMeta specifier is used to send #[xxx] type attributes to the...
Rust Walkthroughs 2024-02-07 ~8 min read
"The compiler is grumpy for you so you don’t have to be"
— Élisabeth Henry @RustFest Zürich

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.