Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
dev.to
...fn normalize_next_url(next: &str, base: &str) -> String { let path_and_query = match next.find("://") { Some(scheme_end) => { let after_scheme = &next[scheme_end + 3..]; match after_scheme.find('/') { Some(path_start) => &after_scheme[path_start..], None => "/", } } None => next, }; format!("{}{}", base, path_and_query) } Enter fullscreen mode Exit fullscreen...
Rust Walkthroughs 2026-07-22 ~3 min read
erickt.github.io
...Token) -> Result<Point, E> { try!(state.expect_struct_start(token, "Point")); let mut x = None; let mut y = None; loop { let idx = match try!(state.expect_struct_field_or_end(&["x", "y"])) { Some(idx) => idx, None => { break ; } }; match idx { Some(0us) => { x = Some(try!(state.expect_struct_value())); } Some(1us...
Project Updates 2015-02-16 ~4 min read
sentry.io
...use sentry::integrations::tracing::EventFilter; use tracing_subscriber::prelude::*; let sentry_layer = sentry::integrations::tracing::layer() .event_filter(|md| match *md.level() { tracing::Level::ERROR => EventFilter::Event, _ => EventFilter::Ignore, }) .span_filter(|md| matches!(*md.level(), tracing::Level::ERROR | tracing::Level::WARN)); tracing_subscriber::registry() .with(tracing_subscriber::fmt::layer()) .with...
Crate v0.49.6 2026-11-16
github.com
...0.3.8 Tracking upstream to match version 0.7.1 Recommended to upgrade from 0.3.7 to get an important bug fix. 0.3.7 Tracking upstream to match version 0.7 0.3.4 Tracking upstream to version 0.6.2. 0.3.3 Tracking upstream to...
Crate v0.7.6 2026-10-02
docs.rs
...Click, click, click!", termion::clear::All, termion::cursor::Goto(1, 1)).unwrap(); stdout.flush().unwrap(); for c in stdin.events() { let evt = c.unwrap(); match evt { Event::Key(Key::Char('q')) => break, Event::Mouse(me) => { match me { MouseEvent::Press(_, x, y) => { write!(stdout, "{}x", termion::cursor::Goto(x, y)).unwrap...
Crate v4.0.6 2025-11-21
doc.rust-lang.org
...In the search_case_insensitive function we’re about to add, the query "rUsT" should match the line containing "Rust:" with a capital R and match the line "Trust me." even though both have different casing from the query. This is our failing test, and it will fail to compile...
The Rust Programming Language Book 2024-02-01 ~6 min read
mdguerrero.com
...fn string_csv_contains(args: &HashMap<String, Value>) -> Result<Value> { let mut out = false; let check_str = match args.get("check_str") { Some(val) => match tera::from_value::<String>(val.clone()) { Ok(v) => v, Err(_) => "".to_string(), }, None => "".to_string(), }; let csv = match args.get("csv") { Some(val) => match tera...
Miscellaneous 2022-02-02 ~12 min read
kerkour.com
...For that, we use the Host extractor and pattern matching: #[tokio::main] async fn main() { // ... let app = Router::new() .route( "/*path", any(|Host(hostname): Host, request: Request<Body>| async move { match hostname.as_str() { "api.mydomain.com" => api_router.oneshot(request).await, _ => website_router.oneshot(request).await, } }), ) .layer(Extension(state...
Rust Walkthroughs 2022-04-20 ~1 min read
doc.rust-lang.org
Destructuring A match block can destructure items in a variety of ways. • Destructuring Tuples • Destructuring Arrays and Slices • Destructuring Enums • Destructuring Pointers • Destructuring Structures See also: The Rust Reference for Destructuring
Rust by Example Book 2024-01-01 ~1 min read
benkonz.github.io
...Just read every character and match the character with a command. If the character isn’t a command, just skip it and move to the next character. Commands Character Meaning > increment data pointer < decrement data pointer + increment the byte at the data pointer - decrement the byte at the data pointer...
Learn More Rust 2020-08-11 ~10 min read
tuckersiemens.com
...Even so, Rust's (appreciated) insistence on exhaustively matching patterns would make us write code like this. match packet(&data)? { Packet::Data => handle_data(), Packet::Ack => handle_ack(), Packet::Error => handle_error(), _ => unreachable!("Didn't we already handle this?"), } Also, you might be tempted to use unreachable! for such code...
Observations/Thoughts 2023-01-04 ~21 min read
fnordig.de
...extern crate hyper; extern crate hubcaps; use std::{env, process}; use hyper::Client; use hubcaps::{Github, ReleaseOptions}; fn main() { let token = match env::var("GITHUB_TOKEN").ok() { Some(token) => token, _ => { println!("example missing GITHUB_TOKEN"); process::exit(1); } }; let client = Client::new(); let github = Github::new("hubcaps/0.1.1...
News & Blog Posts 2016-02-29 ~1 min read
crates.io
GraphQL introspection query and response types. graphql-introspection-query This crate defines structs implementing serde::Deserialize that match the shape returned by a spec-compliant GraphQL API presented with the introspection query.
Crate v0.3.0 2025-12-08
blog.dend.ro
...Vec<Matching>, } #[derive(Deserialize, Debug)] pub struct Matching { pub geometry: String, } Then our client:pub struct OsrmClient { client: Client, base_url: String, } impl OsrmClient { pub fn new(base_url: String) -> Self { let client = Client::new(); Self { client, base_url } } pub fn match_map( &self, profile: &str, points: &[Point], ) -> Result<MultiLineString...
Rust Walkthroughs 2022-01-19 ~9 min read
hackeryarn.com
...Evaluate if you need a macro Design the simplest possible invocation first (determine what your DSL looks like) Try to implement a match arms and adjust the invocation as needed Work one match arm at a time Write sub macros where possible Some of these steps might not mean much...
Rust Walkthroughs 2025-08-20 ~6 min read
rust-lang.github.io
...A filter option evaluates to true if the corresponding generic parameter in the trait definition matches the specified type. The provided message/note/label options are only emitted if the filter operation evaluates to true. The any and all options allow to combine multiple filter options. The any option matches...
RFC 3368 RFC 2023-01-06 ~9 min read
xuanwo.io
...start_match = start_pattern.match(line) if start_match: timestamp, file_name, data_size = start_match.groups() starts[file_name] = (datetime.fromisoformat(timestamp), int(data_size)) end_match = end_pattern.match(line) if end_match: timestamp, file_name, _ = end_match.groups() ends[file_name] = datetime.fromisoformat(timestamp) read_times = [] for...
Observations/Thoughts 2024-01-24 ~11 min read
cfallin.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): match op { // ... Opcode...
Observations/Thoughts 2020-09-23 ~25 min read
seanmonstar.com
...However, we couldn’t add it in 0.1 due to an unexpected compiler behavior that allowed exhaustive matching on the Version constants even though the internal enum wasn’t exposed. This time, we’ve made sure to prevent exhaustive matches, so we can add new versions in the future...
News & Blog Posts 2019-12-03 ~1 min read
aidancully.blogspot.com
...Pin<&mut BarGenerator>, cx: &mut Context<'_>) -> GeneratorState<() /* yield type */, usize /* result type */> { loop { match vars { Variant1 { ref var1 } => { let var2 = &var1; let await_point = baz(); *vars = Variant2 { var1, var2, await_point }; } Variant2 { ref var1, ref var2, ref await_point } => { match Pin::new_unchecked(&mut await_point).poll(&mut cx) { Poll...
Observations/Thoughts 2022-08-10 ~5 min read
"When your Rust build times get slower after adding some procedural macros: We call that the syn tax 🦀"

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.