Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
github.com
...Note that N is just a reasonable guess and is not guaranteed to match the actual cache line length of the machine the program is running on. The size of CachePadded<T> is the smallest multiple of N bytes large enough to accommodate a value of type T . The alignment...
Crate v1.3.0 2023-05-12
blog.nindalf.com
...no_mangle with extern "C" matches 35.8k files. no_mangle without extern "C" matches 14.8k files. About a third of functions with this attribute use the Rust ABI. They could be making a conscious choice here, we don’t know. For example, someone on internals.rust-lang.org...
Observations/Thoughts 2023-03-01 ~5 min read
docs.rs
...Example use quote::quote; use syn::Ident; use proc_macro2::Span; use proc_macro_crate::{crate_name, FoundCrate}; fn import_my_crate() { let found_crate = crate_name("my-crate").expect("my-crate is present in `Cargo.toml`"); match found_crate { FoundCrate::Itself => quote!( crate::Something ), FoundCrate::Name(name) => { let ident...
Crate v3.5.0 2026-03-04
docs.rs
...u32 = from_value(Value::UInt(65536)); assert_eq!(via_test_protocol, via_bin_protocol); let unknown_val = // ... // Maybe it is a float? let unknown_val = match from_value_opt::<f64>(unknown_val) { Ok(float) => { println!("A float value: {}", float); return Ok(()); } Err(FromValueError(unknown_val)) => unknown_val, }; // Or a string...
Crate v28.0.0 2026-03-17
ruudvanasseldonk.com
...Let’s try again:pub enum KelvinError { ParseFailed, InvalidVersion } pub fn check_next_version(previous_versions: &[u32], version_string: &str) -> Result<u32, KelvinError> { let version = match version_string.parse::<u32>() { Ok(n) => n, Err(_) => return Err(KelvinError::ParseFailed) }; if version < previous_versions.iter().cloned().min() { Ok(version) } else { Err(KelvinError...
From the Blogosphere 2015-06-22 ~11 min read
rust-lang-nursery.github.io
...String, } fn parse_email(s: &str) -> Result<String, String> { match s.split_once('@') { Some((user, domain)) if !user.is_empty() && domain.contains('.') => Ok(s.to_string()), _ => Err("Invalid email format".to_string()), } } fn parse_config(s: &str) -> Result<PathBuf, String> { let path = PathBuf::from(s); if path.is_file() { Ok...
The Rust Cookbook Book 2024-01-01 ~1 min read
workers.wasmlabs.dev
...let count = cache.get("counter"); let count_num = match count { Some(count_str) => count_str.parse::<u32>().unwrap_or(0), None => 0, }; let response = format!( "<!DOCTYPE html><body><h1>Key / Value store in Rust</h1><p>Counter: {}</p><p>This page was generated by a Wasm modules built from Rust...
Rust Walkthroughs 2023-01-18 ~6 min read
tessera-ui.github.io
...You don't have to follow rules-of-hooks; you can safely use it inside control flow statements like if, loop, match, etc.However, components like virtual lists may not build all child components every frame. Using remember naively could cause state to drift to the next visible component instance...
Rust Walkthroughs 2025-12-17 ~8 min read
depth-first.com
...subgraph isomorphism; matching; and cycle perception. Isomorphism finds embeddings and atom/bond mappings between two molecules. Matching is used for kekulization, or the assignment of alternating single/double bonds in certain classes of molecule. Many important molecules in medicine and commerce contain one or more cycles, so cycle perception is...
News & Blog Posts 2020-02-18 ~8 min read
thunderseethe.dev
...Ast<TypedVar>) -> IR { match ast { //... } } } We’re well versed in this pattern by now. Match on the ast and produce an IR term for each case. First up is variables:Ast::Var(_, TypedVar(var, ty)) => IR::Var(Var::new( self.supply.supply_for(var), self.types.lower_ty(ty), )), A...
Rust Walkthroughs 2025-02-05 ~7 min read
blog.servo.org
...gterzian rewrote the image loading algorithm to match the behaviour mandated by the specification. waffles added support for various CSS Grid properties in Stylo. jdm removed a GC safety hazard when using CSS transitions. eloycoto improved the behaviour of getBoundingClientRect for elements with margins and transforms. cynicaldevil ensured that all...
News & Blog Posts 2017-06-06 ~1 min read
developerlife.com
...syn::Type = syn::parse_str::<syn::Type>(&traits.join(" + ")).unwrap(); let where_clause_ts = match where_clause { Some(where_clause) => { let where_predicate_punctuated_list = &where_clause.predicates; let modified_where_predicates_ts = where_predicate_punctuated_list .iter() .map( |where_predicate| match where_predicate { syn::WherePredicate::Type(_) => { quote! { #where_predicate...
Rust Walkthroughs 2023-04-26 ~35 min read
mattforni.github.io
...extern crate args; extern crate getopts; use getopts::Occur; use std::process::exit; use args::{Args,ArgsError}; use args::validations::{Order,OrderValidation}; const PROGRAM_DESC: &'static str = "Run this program"; const PROGRAM_NAME: &'static str = "program"; fn main() { match parse(&vec!("-i", "5")) { Ok(_) => println!("Successfully parsed args"), Err(error...
Crate v2.2.0 2018-02-27
johns.codes
...let mut exec = sql_jr_execution::Execution::new(); loop { let readline = rl.readline(">> "); match readline { Ok(line) => { rl.add_history_entry(line.as_str()); let line: &str = line.as_ref(); let res = exec.parse_and_run(line); match res { Ok(exec_res) => println!("{exec_res}"), Err(e) => { let mut s...
Rust Walkthroughs 2023-01-25 ~11 min read
metalbear.co
...Our handler will be called using the C ABI calling convention, it will match on syscalls and redirect them based on their type to their specific detours and return the result in the specific register conforming to the C ABI.#[no_mangle] unsafe extern "C" fn c_abi_syscall_handler...
Rust Walkthroughs 2022-08-17 ~11 min read
tmandry.gitlab.io
...let xs = vec![1, 2, 3]; let mut gen = move || { let mut sum = 0; { let mut iter0 = xs.iter(); loop { match iter0.next() { Some(x0) => { sum += x0; yield sum; // Suspend0 } None => break, } } } { let mut iter1 = xs.iter().rev(); loop { match iter1.next() { Some(x1) => { sum -= x1; yield sum; // Suspend1 } None...
News & Blog Posts 2019-09-10 ~16 min read
doc.rust-lang.org
pub trait Display
...As such, the output of Display might not be possible to parse, and even if it is, the result of parsing might not exactly match the original value. However, if a type has a lossless Display implementation whose output is meant to be conveniently machine-parseable and not just meant...
trait core Stable since 1.0.0 Version 1.100.0-nightly
chunkofcoal.com
...But the low nibble 0xC only matches COMMA. The AND eliminates QUOTE, leaving just COMMA.Building these lookup tables requires some care. Because the AND combines results from 2 independent lookups, you’re effectively designing a grid. Any byte whose high nibble matches and whose low nibble matches will be...
Rust Walkthroughs 2026-03-25 ~11 min read
cat-solstice.github.io
...That’s wild! replace the hint::select_unpredictable with the worst match statement possible: match f( unsafe { slice.get_unchecked(mid) } ) { Ordering::Less | Ordering::Equal => base = mid, Ordering::Greater => {}, } The performance of all tested cases are now similar to each other (and good) but there is no more conditional moves...
Observations/Thoughts 2025-10-29 ~11 min read
guillaumegomez.github.io
...by text “fn main” in a line comment. @frewsxcv indicated how ChildStd{in,out,err} FDs are closed. @thombles improved diagnostics when attempting to match tuple enum variant with struct pattern. @tirr-c made a friendlier error message for closure argument type mismatch. @estebank pointed at parameter type on E0301...
News & Blog Posts 2017-10-03 ~1 min read
"Rust is not what makes these projects awesome. These projects are what make Rust awesome."

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.