Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
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
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
rust-lang.github.io
...Features: + perf Enables all performance related features + perf-dfa Enables the use of a lazy DFA for matching + perf-inline Enables the use of aggressive inlining inside match routines + perf-literal Enables the use of literal optimizations for speeding up matches + std When enabled, this will cause regex to use...
RFC 3416 RFC 2023-04-14 ~3 min read
blog.burntsushi.net
...Vec<StateID>, // Whether a particular state ID corresponds to a match state. // Guaranteed to have length equal to the number of states. is_match_id: Vec<bool>, } impl DFA { // Returns true if the DFA matches the entire 'haystack'. // This routine always returns either true or false for all inputs. // It...
Observations/Thoughts 2022-08-10 ~33 min read
rust-lang.github.io
...And requiring matching on every use of the type is less ergonomic. For example, the clamp RFC would naturally use a RangeInclusive parameter, but because it still needs to assert!(start <= end) in the NonEmpty arm, the noise of the Empty vs NonEmpty match provides it no value. • a...b...
RFC 1192 RFC 2015-07-07 ~5 min read
rustc-dev-guide.rust-lang.org
...In the names->numbers phase, if the query has only one name in it, the editDistance function is used to find a near match if the exact match fails, but if there's multiple items in the query, non-matching items are treated as generics instead. This means hahsmap will...
Guide to Rustc Development Book 2024-01-01 ~16 min read
matthewkmayer.github.io
...pub fn is_commit_event(&self) -> bool { self.is_accepted_pr() || self.is_direct_push_event() } pub fn is_accepted_pr(&self) -> bool { if self.event_type != "PullRequestEvent" { return false; } match self.payload { Some(ref payload) => match payload.pull_request { Some(ref pr) => match pr.merged { Some(merged) => merged, None...
Learn 2020-07-28 ~11 min read
"If the Rust community has an ethos, it's that software should have strong static typing, but people should have soft dynamic typing."

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.