Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
dev.to
...impl AgentError { pub fn is_retryable(&self) -> bool { matches!( self, Self::Network(_) | Self::Provider { status: Some(500..=599), .. } ) } pub fn is_client_error(&self) -> bool { matches!(self, Self::Provider { status: Some(s), .. } if *s >= 400 && *s < 500) } } Enter fullscreen mode Exit fullscreen mode This was one of the things Rust...
Project/Tooling Updates 2026-03-11 ~5 min read
www.coralbark.net
...The first version of my Python script just tried to match a regular expression against each line. It took over 4 minutes on my sample data, so I made a few tweaks (e.g. I noticed I was compiling the regular expression for each line). It still took over 4...
Observations/Thoughts 2020-10-21 ~4 min read
xd009642.github.io
...Error, { let mut start = None; while let Some(Ok(msg)) = receiver.next().await { if let Ok(text) = msg.into_text() { match serde_json::from_str::<RequestMessage>(&text) { Ok(RequestMessage::Start(start_msg)) => { info!(start=?start, "Initialising streamer"); start = Some(start_msg); break; } Ok(RequestMessage::Stop(_)) => { warn!("Unexpected stop received as...
Rust Walkthroughs 2025-01-22 ~11 min read
durka.github.io
...fn main() { let dir = PathBuf::from(env::args().skip(1).next().unwrap()); match local_du(&dir) { Ok(bytes) => println!("{} {}", bytes, dir.display()), Err(error) => println!("ERROR: {:?}", error), } } v1: quick and dirty Here is the first version of my local_du function. You’ll notice that I like chaining iterators. The...
News & Blog Posts 2017-08-15 ~7 min read
recursion.wtf
...let result = recursive_tree.collapse_layers(|expr| { use ExprLayer::*; match expr { Add { a, b } => a + b, Sub { a, b } => a - b, Mul { a, b } => a * b, LiteralInt { literal } => literal, } }) Expand and Collapse in a Single Pass As a reminder, the RecursiveTree representing (5 - 3) * (3 + 12) looks like this: Here...
Observations/Thoughts 2022-10-12 ~7 min read
postacnormalna.pl
...Dlatego zaczynamy od match. Zwróćmy uwagę na słowo kluczowe ref w ramieniu Some(ref base_obj). Dzięki temu Rust nie krzyczy. Jeśli je pominiemy, wypluje taki błąd: match self.base_template { | ^^^^^^^^^^^^^^^^^^ help: consider borrowing here: `&self.base_template` 49 | Some(base_obj) => { | -------- | | | data moved here | move occurs because `base_obj...
Rust Walkthroughs 2020-11-18 ~11 min read
tweedegolf.nl
...So there are a lot of code patterns that get optimized for us.For example:pub fn process_command() { match get_command() { CommandId::A => send_response(123), CommandId::B => send_response(456), } } Once compiled with optimizations turned on, the compiler generates the following assembly:; x86-64 process_command: push rax...
Rust Walkthroughs 2026-04-15 ~11 min read
ianjk.com
...If it succeeds we insert the component with component_vec[entity] = Some(component); and return; What if a component_vec doesn't exist in the World yet? Let's handle that case by creating a new component_vec if there isn't a matching one: /* continued from above */ // No matching...
Rust Walkthroughs 2021-03-24 ~12 min read
rust-analyzer.github.io
#8156 correctly lower `TraitRef`s with default params. #8144 (first contribution) fix crash when trying to display closure types. #8142 hide incorrect ref match completions for struct fields/methods. #8138 set up a search scope when searching for MBE macro references. #8159 try to ignore proc-macro stdout to prevent...
Project/Tooling Updates 2021-03-31 ~1 min read
fredrik.anderzon.se
...if let Ok(num) = _req.param("id").unwrap().parse::<i16>() { match _req.param("action").unwrap() { "toggle" => { store.dispatch( Todos( Toggle(num) ) ) }, "remove" => store.dispatch( Todos( Remove(num) ) ), _ => (), } } else { // Otherwise look for a show action match _req.param("action").unwrap() { "show" => { match _req.param("id").unwrap() { "all" => store.dispatch( Visibility( ShowAll...
News & Blog Posts 2016-07-19 ~33 min read
maniagnosis.crsr.net
...So I broke down and created some macros: #[macro_export]macro_rules! unpack { ($e:expr,$m:expr) => ( match $e { Ok(v) => v, Err(e) => panic!(format!("{}: {}", $m, e.to_string())), })}#[macro_export]macro_rules! expect { ($e:expr,$m:expr) => ( match $e { Some(e) => e, None => panic!($m), })}#[macro_export]macro...
From the Blogosphere 2015-07-27 ~11 min read
deepfence.io
...It usually relies on the haystack finding approach but also regular expression matching approaches. Matching happens on different parts of the HTTP message, it can be headers, port, or even HTML body. Needless to say that such operations are CPU intensive. Here is a rule example:alert http $HOME_NET...
Project/Tooling Updates 2022-07-27 ~16 min read
rust-lang-nursery.github.io
...get_typed_func looks up an export by name and checks that its signature matches the Rust generic parameters — (i32, i32) in, i32 out. Core WebAssembly function parameters are limited to four numeric types: i32, i64, f32, and f64. Strings, structs, and other complex values cannot cross the function boundary...
The Rust Cookbook Book 2024-01-01 ~1 min read
rsdlt.github.io
...another sequence of units based on of the dictionary.Make the Key and the Message have the same size (number of units or characters).Encode / Decode by matching each unit (or character) in the message and the key in the Vigenére table.For example:Dictionary: ABCDVigenére Matrix:ABCDBCDACDABDABCKey: DCABADMessage: BADCADEncode...
Rust Walkthroughs 2022-09-28 ~18 min read
rust-analyzer.github.io
#8222 don’t mark unlinked file diagnostic as unused. #8246 (first contribution) update VIM YCM installation instructions. #8250 classify associated types in paths more accurately. #8256 make "Move item" commands work in more cases. #8261 fix expansion of OR-patterns in match check. #8266 fix generic argument lowering in qualified...
Project/Tooling Updates 2021-04-07 ~1 min read
cryptographycaffe.sandboxaq.com
...Specifically, the properties we aim to prove ensure that the configuration defined by a Sandwich user matches what Sandwich actually sets when interacting with the cryptographic library.In this initial effort, we focused on the OpenSSL 3 version of Sandwich and defined the following security properties.Safe TLS Protocol VersionsPolicy...
Miscellaneous 2025-04-02 ~9 min read
www.greyblake.com
...Vehicle) -> VehicleRecord { let Vehicle { id , vehicle_type } = vehicle; let (kind, fuel, max_speed_kph) = match vehicle_type { VehicleType::Car { fuel, max_speed_kph } => { ( "Car".to_owned(), Some(fuel_to_str(fuel).to_owned()), max_speed_kph.map(|speed| speed.try_into().unwrap() ) ) } Bicycle => { ( "Bicycle".to_owned(), None, None, ) } }; let id...
Rust Walkthroughs 2022-11-02 ~7 min read
www.sheshbabu.com
...Self::Message) -> ShouldRender { match message { + Msg::GetProducts => { + self.state.get_products_loaded = false; + let handler = + self.link + .callback(move |response: api::FetchResponse<Vec<Product>>| { + let (_, Json(data)) = response.into_parts(); + match data { + Ok(products) => Msg::GetProductsSuccess(products), + Err(err) => Msg::GetProductsError(err), + } + }); + self.task = Some(api::get_products(handler)); + true...
Learn More Rust 2020-08-11 ~29 min read
www.chriskrycho.com
...Pattern matching and the value of expression blocks. Functions, closures, and an awful lot of Swift syntax. Sum types (enums) and more on pattern matching. Classes and structs (product types), and reference and value types. Hopes for the next generation of systems programming. Properties: type and instance, stored and computed...
News & Blog Posts 2016-03-07 ~3 min read
jrvidal.github.io
...The wildcard pattern _ [...] In this case it acts like a final "catchall" in this match expression. And more... There are many more minor contextual details that I've enjoyed adding (some of them were already mentioned in my previous post): Writing the receiver of a method explicitly: mut self: &Self...
Tooling 2020-12-16 ~3 min read
"I have experience in multiple styles of MMA gained from fighting the borrow checker, if that counts."

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.