Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
rust-lang.github.io
Summary Provide a simple model describing three kinds of structs and variants and their relationships.Provide a way to match on structs/variants in patterns regardless of their kind (S{..}).Permit tuple structs and tuple variants with zero fields (TS()). Motivation There's some mental model lying under the current...
RFC 1506 RFC 2016-02-07 ~5 min read
rust-analyzer.github.io
...for fill_match_arms with local enums. #11795 correctly suggest auto importing traits from aliases. #11791 fix and improve signature help. #11802 add stubs to make proc macros work that use the SourceFile API. #11825 don’t complete Drop::drop for qualified paths. #11831 disable ref_match for qualified paths...
Project/Tooling Updates 2022-03-30 ~1 min read
fredrik.anderzon.se
...It will print the todos only for the matching filter. We've broken out printing of a single todo item to a print_todo function so that it's easy to call it in several branches of our match statement. Matching on enums is very straight forward as you can...
News & Blog Posts 2016-06-27 ~25 min read
rust-analyzer.github.io
#8611 (first contribution) add support for boolean values to "Fill match arms". #8658 (first contribution) check more carefully for cases when a rename can’t be done. #8582 (first contribution) fix typo in comparison semantic token type. #8600 fix project loading hang. #8606 fix "Registering progress handler" error. #8639 fix...
Project/Tooling Updates 2021-04-28 ~1 min read
adventures.michaelfbryan.com
...f32) -> Point { let raw = match self.units { Units::Millimetres => Point::new::<millimeter>(x, y, z), Units::Inches => Point::new::<inch>(x, y, z), }; match self.coordinate_mode { CoordinateMode::Absolute => raw, CoordinateMode::Relative => raw + self.current_location, } } fn calculate_feed_rate(&self, command: &GCode) -> Velocity { let raw = match command.value_for...
News & Blog Posts 2019-11-12 ~12 min read
holovskyi.github.io
...client.subscribe("sensors/+/+/temperature", QoS::AtMostOnce).await?; while let Ok(notification) = eventloop.poll().await { match notification { Event::Incoming(Packet::Publish(publish)) => { let parts: Vec<&str> = publish.topic.split('/').collect(); if parts.len() == 4 && parts[0] == "sensors" && parts[3] == "temperature" { let location = parts[1]; let sensor_id = parts[2]; match serde...
Project/Tooling Updates 2026-07-08 ~4 min read
noiseonthenet.space
...T ) { match self.root{ None => { self.root = Node::new(value).into(); } Some(ref mut node) => { Tree::<T>::insert_recursive(node, value); } } } fn insert_recursive(node : & mut Node<T>, value : T){ if value > node.value{ match node.right{ None => { node.right = Node::new(value).into(); } Some(ref mut n) => { Tree::<T...
Observations/Thoughts 2024-04-17 ~7 min read
dev.to
...Stripping unwanted trailing characters went from a slow regex match inside a loop: // The old, slow regex way pub(crate) fn trim_unwanted_end_chars<'a>(&self, phone_number: &'a str) -> &'a str { // ... loop with regex.full_match() ... } Enter fullscreen mode Exit fullscreen mode To a single, native Rust iterator...
Project/Tooling Updates 2026-03-11 ~7 min read
arzg.github.io
...u8) { let mut lhs = match p.peek() { // snip }; loop { let op = match p.peek() { Some(SyntaxKind::Plus) => InfixOp::Add, Some(SyntaxKind::Minus) => InfixOp::Sub, Some(SyntaxKind::Star) => InfixOp::Mul, Some(SyntaxKind::Slash) => InfixOp::Div, _ => return, // we’ll handle errors later. }; let (left_binding_power, right_binding_power) = op.binding_power...
Rust Walkthroughs 2020-12-16 ~16 min read
svartalf.info
...io_object_t) -> kern_return_t; } unsafe { let match_dict = IOServiceMatching( b"IOPMPowerSource\0".as_ptr() as *const c_char ); let mut iterator: io_iterator_t = mem::uninitialized(); // TODO: Handle the possible error let _result = IOServiceGetMatchingServices( master_port, match_dict, &mut iterator, ); } IOServiceMatching documentation says that the returned match_dict...
News & Blog Posts 2019-06-04 ~7 min read
doma.dev
...Equivalently, one can't solve the matching parentheses problem with a regular expression. The simplest stack machine is needed for that. Stack automaton can be in several states at once. A state with no transitions "fizzles" on any input. (@\* matches character '(' with any stack state. ε@ε matches instantaneously as...
Rust Walkthroughs 2021-03-31 ~8 min read
boats.gitlab.io
...Match ergonomics Match ergonomics have been stable for a while, but I continue to find them paying dividends. I’m sure there are times where I’ve used it without even noticing it, but there were many cases where I did notice. My experience usually went like this: I write...
News & Blog Posts 2018-07-31 ~6 min read
rust.code-maven.com
...u32 = match args[1].parse() { Ok(value) => value, Err(err) => { eprintln!("Invalid parameter: '{}'. It must be an integer", err); eprintln!("Usage: {} INTEGER", &args[0]); std::process::exit(1); } }; number } Here we have a match that is expected to return a 32-bit unsigned integer, a u32. However, if the user...
Miscellaneous 2023-12-06 ~3 min read
kerkour.com
...Pattern matching in Rust can be used to match against many other expressions: match x { 42 => println!("Good!"), _ => println!("Bad!"), } let boolean = true; // Match is an expression too let binary = match boolean { false => 0, true => 1, }; let x = Some(42u64); match x { Some(1) => println!("1"), Some(42) => println!("42...
Rust Walkthroughs 2022-03-09 ~9 min read
www.diegofreijo.com
...pub fn scan_token(&mut self) -> TokenResult<'a> { self.skip_whitespaces(); self.start = self.current; match self.advance() { Some(c) => match c { _ if Scanner::is_alpha(c) => self.identifier(), _ if Scanner::is_digit(c) => self.number(), // Single-char tokens '(' => self.make_token(TokenType::LeftParen), ')' => self.make_token(TokenType::RightParen), // (...) '<' => self...
Rust Walkthroughs 2022-02-09 ~13 min read
blog.burntsushi.net
...Match In this case, Split means “jump to two different instructions simultaneously.” In particular, if either branch executes the Match instruction, then the entire regex will match. If both Char instructions fail, then it’s impossible to reach the Match instruction. Clarifying the divide: native regexes vs. dynamic regexes The...
Community Updates 2014-05-05 ~18 min read
smallcultfollowing.com
...it starts as we enter the match (match &message) and continues into the match arm. On the else branch of the match, the borrow is still in use (in the form of the data variable), but in the if branch, it is not (and hence we can call tx.send...
News & Blog Posts 2018-11-06 ~5 min read
lwn.net
...Matches involving tuples, for example, must try matching a single element at a time, which is something that the GCC internal representation wasn't designed to do. Arm guards (essentially an extra if controlling whether a specific match occurs) also complicate things, since the variables set by the match must...
Observations/Thoughts 2022-10-26 ~8 min read
rust-analyzer.github.io
...ignore macro imports from extern crate self. #8863 don’t add extra whitespace around fields. #8880 fix module renaming. #8875 avoid false positive "Missing match arm" when an or-pattern has mismatched types. #8884 fix "Add explicit type" producing invalid code on @ patterns. #8893 update outdated auto-import documentation. #8902...
Project/Tooling Updates 2021-05-26 ~1 min read
doc.rust-lang.org
...3 }; match foo { Foo { x: (1, b), y } => println!("First of x is 1, b = {}, y = {} ", b, y), // you can destructure structs and rename the variables, // the order is not important Foo { y: 2, x: i } => println!("y is 2, i = {:?}", i), // and you can also ignore some variables: Foo...
Rust by Example Book 2024-01-01 ~1 min read
"I care about this community, including its human and social nature. I want others to appreciate those qualities, and I don't want to see them compromi..."

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.