Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
hacks.mozilla.org
...This function is essentially just a large match statement over the opcode of the root CLIF instruction, with the match-arms looking deeper as needed. Here is a simplified version of the match-arm for an integer add operation lowered to AArch64 (the full version is here): <span class="k...
Observations/Thoughts 2020-10-14 ~17 min read
siciarz.net
...use std::env; fn main() { match env::var("LANG") { Ok(lang) => println!("Language code: {}", lang), Err(e) => println!("Couldn't read LANG ({})", e), }; } $ cargo run Language code: pl_PL.UTF-8 envy envy is a small crate that uses serde to automatically deserialize process environment into a Rust struct. #![feature...
News & Blog Posts 2016-12-06 ~3 min read
docs.rs
...Some things wouldn't ever be written on one line, like this match expression, and certainly not with a comma in front of the closing brace: fn eq(&self, other: &IpAddr) -> bool { match other { IpAddr::V4(v4) => self == v4, IpAddr::V6(_) => false, } } Some places use non-multiple-of-4 indentation...
Crate v0.3.0 2026-07-18
www.seventeencups.net
...i32) -> f32 { match index { 0 => self.threshold, _ => 0.0, } } fn set_parameter(&mut self, index: i32, value: f32) { match index { // We don't want to divide by zero, so we'll clamp the value 0 => self.threshold = value.max(0.01), _ => (), } } fn get_parameter_name(&self, index: i32) -> String { match...
News & Blog Posts 2017-03-28 ~6 min read
doc.rust-lang.org
...match operand.into_future() { mut pinned => loop { let mut pin = unsafe { Pin::new_unchecked(&mut pinned) }; match Pin::future::poll(Pin::borrow(&mut pin), &mut current_context) { Poll::Ready(r) => break r, Poll::Pending => yield Poll::Pending, } } } where the yield pseudo-code returns Poll::Pending and, when re-invoked, resumes...
The Rust Reference Book 2024-01-01 ~1 min read
radekmie.dev
...It’d look like this:// The below code is just a simplification -- it may not compile! impl<Id> Expression<Id> { fn add_casts(&self, type_: &Type<Id>) -> Result<Self, Error<Id>> { let mut clone = match self { Self::Access { lhs, rhs } => { let lhs_type = lhs.infer()?; let Type::Arrow { lhs: key...
Observations/Thoughts 2024-04-03 ~4 min read
rust-lang.github.io
...Unresolved questions The behavior specified here should match the behavior of MSVC at least. Does it match the behavior of other C/C++ compilers as well? Should it still be safe to borrow fields whose alignment is less than or equal to the specified packing or should all field borrows...
Updates from Rust Core 2018-04-17 ~3 min read
www.fpcomplete.com
...This function is all about pattern matching and unifying the error representation using .into(): fn poll_ready( &mut self, cx: &mut std::task::Context<'_>, ) -> std::task::Poll<Result<(), Self::Error>> { match self.web.poll_ready(cx) { Poll::Ready(Ok(())) => match self.grpc.poll_ready(cx) { Poll::Ready(Ok(())) => Poll::Ready...
Rust Walkthroughs 2021-09-22 ~11 min read
crates.io
Emulate macro-rules pattern matching in procedural macros proc-macro-rules macros You are probably looking for the proc-macro-rules crate.
Crate v0.4.0 2023-11-07
rustc-dev-guide.rust-lang.org
...The subroutines that decide whether a particular impl/where-clause/etc applies to a particular obligation are collectively referred to as the process of matching. For impl candidates , this amounts to unifying the impl header (the Self type and the trait arguments) while ignoring nested obligations. If matching succeeds then...
Guide to Rustc Development Book 2024-01-01 ~7 min read
tech.nextroll.com
...For your sanity, the match statement in this function is shortened for this example. fn recurse(stmt: &Statement, errors: &mut Vec<String>, mut is_global: bool) { let mut allow_vars = true; if is_global { is_global = false; allow_vars = false; } match stmt { Statement::FunctionDeclaration(func) => match func { FunctionDeclarationStat::Local { body...
Rust Walkthroughs 2022-07-13 ~4 min read
rustacean-station.org
...16:09 - matches! Macro documentation Jon proposes assert_matches 18:13 - Error::description deprecation RFC Soft deprecation in 1.27 failure thiserror anyhow eyre Jane expermenting with track_caller in eyre 24:23 - Other changes in 1.42 Documentation improvements to cargo 26:47 - Rust 1.43 27:17 - item...
News & Blog Posts 2020-05-19 ~1 min read
www.ncameron.org
...Changes to rules around temporary lifetimes for if let and the last expression in a block (2024).No need for pattern matching branches for impossible variants (e.g, using ! or Infallible) (1.82).Restrictions on using explicit referencing in patterns with match ergonomics (2024).Standard libraryLazyCell and LazyLock, alternatives to...
Observations/Thoughts 2025-10-29 ~3 min read
blog.logrocket.com
...fn main() { let args = Arguments::parse(); let logger = logger::DummyLogger::new(args.verbosity as usize); match args.cmd { SubCommand::Count { package_name } => match count(&package_name, args.max_depth, &logger) { Ok(c) => println!("{} uses found", c), Err(e) => eprintln!("error in processing : {}", e), }, SubCommand::Projects { start_path, exclude, } => match projects...
Rust Walkthroughs 2022-04-20 ~23 min read
thedataquarry.com
...The key difference here is how we use a match statement to replace multiple patterns using a single closure. The &capture[2] syntax is used to access the second capture group in the regex match, which is the suffix of the contraction, and this is then passed to the match...
Rust Walkthroughs 2024-02-14 ~19 min read
docs.rs
...extern crate version_check as rustc; match rustc::is_min_date("2018-12-18") { Some(true) => "Yep! It's recent!", Some(false) => "No, it's older.", None => "Couldn't determine the rustc version." }; Check that the running compiler supports feature flags: extern crate version_check as rustc; match rustc::is...
Crate v0.9.5 2024-07-25
adventures.michaelfbryan.com
...Clear) -> Self::Response { self.ticks.clear(); Ack::new() } } We can now add the match arm to our Router’s handle_message() method. // sim/src/router.rs use fps_counter::Clear; impl<'a> MessageHandler for Router<'a> { fn handle_message(&mut self, msg: &Packet) -> Result<Packet, CommsError> { match msg.id() { 1...
News & Blog Posts 2019-10-15 ~9 min read
tech.stonecharioteer.com
...When the responding IP matches our target, we’ve reached the destination and break out. This needs sudo to run because of the raw ICMP socket. 1 2 3 4 5 6 7 8 9 10 11 $ sudo cargo run 1 <tailscale-ip> 2 <router-ip> 3 <isp-gateway-ip...
Rust Walkthroughs 2026-04-15 ~16 min read
siciarz.net
...ReplyEntry) { println!("lookup(parent={}, name={})", parent, name.display()); let inode = match self.inodes.get(name.as_str().unwrap()) { Some(inode) => inode, None => { reply.error(ENOENT); return; }, }; match self.attrs.get(inode) { Some(attr) => { let ttl = Timespec::new(1, 0); reply.entry(&ttl, attr, 0); }, None => reply.error(ENOENT), }; } This method...
24 Days of Rust continues! 2014-12-22 ~4 min read
www.youtube.com
...Explicitly matching every Result case is required to avoid panic. Or is it? Let's learn together to use turbofish syntax and the anyhow crate to produce more elegant but still idiomatic Rust code that allows us to explicitly handle Result(s) as necessary. We'll demonstrate making Rest API...
Video 2023-08-28
"Clippy’s Favorite Activity Is Criticizing Clippy’s Codebase"

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.