Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
v5.chriskrycho.com
...let an_example = Example::<String, String, String>::RegularWithGeneric { field: "Hello".into() }; match an_example { Example::RegularWithGeneric { field } => println!("The field is {field}"), _ => println!("Skipping"), } And here’s the same in Swift:3 let an_example = Example<String, String, String>.regularWithGeneric( RegularWithGeneric(field: "Hello") ) switch an_example { case .regularWithGeneric(let wrapped...
Observations/Thoughts 2022-07-13 ~2 min read
aibodh.com
...tinyrt/src/state_machine.rsPlace this inside the match armloop { match this { CartTotal::Start { socks, .. } => { match Pin::new(socks).poll(cx) { Poll::Pending => { println!("[cart] Start: socks price not back yet, waiting"); return Poll::Pending; } Poll::Ready(socks_price) => { println!( "[cart] Start -> GotSocks: socks are ${socks_price}" ); let CartTotal::Start...
Rust Walkthroughs 2026-07-01 ~22 min read
rust-analyzer.github.io
#11107 (first contribution) fix generic type substitution when implementing trait with associated type. #11061 support Move if to guard on if-else chains. #11178 keep block modifiers in Replace match with if let. #11184 pass through mutable parameter references when extracting a function. #11195 pass through reference modifiers when extracting...
Project/Tooling Updates 2022-01-12 ~1 min read
rust.code-maven.com
...path, match Setting status to 404 page not found. with_status_code, with_header, path. Tiny HTTP redirect URL. with_header, Header, HeaderField, Request, Response. Gabor Szabo, the author of the Rust Maven web site maintains several Open source projects in Rust and while he still feels he has tons...
Rust Walkthroughs 2023-12-20 ~1 min read
gitlab.com
...The essential part of security in cookies and localStorage is the idea of an "origin", which is supposed to match roughly with what people intuitively think of as a website, so each "website" gets its own local storage: On the regular web, an origin is an effective Top-Level Domain...
Project/Tooling Updates 2022-01-26 ~2 min read
fasterthanli.me
...2 Match arms are patterns match arms are also patterns, just like if let: fn print_number(n: Number) { match n { Number { odd: true, value } => println!("Odd number: {}", value), Number { odd: false, value } => println!("Even number: {}", value), } } // this prints the same as before Exhaustive matches A match has to be...
Learn Standard Rust 2020-09-09 ~31 min read
tech.fpcomplete.com
...Then we pattern match on the Result and return a Pid1Error::ChildPidToBig variant if the conversion fails. You may be wondering why we used this pattern matching instead of ?. With the right From implementation, ? would work just fine. However, if you want to include additional context with your error, like...
News & Blog Posts 2019-12-03 ~22 min read
www.brandons.me
...f32 }, } impl Shape { pub fn perimeter(&self) -> f32 { match self { Shape::Rectangle { width, height } => width * 2.0 + height * 2.0, Shape::Triangle { side } => side * 3.0, Shape::Circle { radius } => radius * 2.0 * std::f32::consts::PI } } pub fn area(&self) -> f32 { match self { Shape::Rectangle { width, height } => width * height, Shape...
Rust Walkthroughs 2022-01-12 ~10 min read
www.thecodedmessage.com
...Endian) -> [u8; 4] { match endianness { Endian::Little | Endian::Native => { ... } Endian::Big => { ... } } } fn from_endian_bytes([u8: 4], endianness: Endian) -> Self { match endianness { Endian::Little | Endian::Native => { ... } Endian::Big => { ... } } } } This would also allow us to implement the concept of “native” byte order a little differently, and create more names for byte...
Observations/Thoughts 2021-11-24 ~19 min read
nitschinger.at
...We can now utilize pattern matching to distinguish between success and error, and if it is successful print out the length of the Vector: 1 2 3 4 match cores { Ok(c) => println!("There are {} cores on this machine.", c.len()), Err(e) => panic!(format!("Could not load cores because...
News & Blog Posts 2016-01-11 ~11 min read
rust-analyzer.github.io
#9123 (first contribution) add Gentoo installation instructions. #9091 fix opening single files. #8717, #9105 update match checking algorithm. #9090 fix type inference with arbitrary self types. #9130 make prefix/suffix parameter inlay hint hiding heuristic is more strict. #9079 don’t take the parent kind of trailing attributes in attribute...
Project/Tooling Updates 2021-06-09 ~1 min read
miren.dev
...Add another variant tomorrow and every match in the codebase that doesn’t cover the new case lights up red at compile time. I can stop writing tests for my own forgetfulness. The ? operator is kind of a revelation to an if err != nil-addled brain like mine. One character...
Observations/Thoughts 2026-04-29 ~5 min read
rust-analyzer.github.io
#4065, #4128 complete unqualified enum variants #4105 code completion for attributes. #3954 we now pre-select completion variant if it matches the expected type. #4006 syntax highlighting for format strings #4069, #4070, #4158 improve documentation. #4098 add setup instructions for YouCompleteMe. #4082 implement rust-analyzer --help. #4090 fix naming of...
News & Blog Posts 2020-05-05 ~1 min read
alexliesenfeld.com
...None, path_matches: None, method: Some("POST"), headers: Some({"Authorization": "token TOKEN", "Content-Type": "application/json"}), header_exists: None, body: None, json_body: None, json_body_includes: None, body_contains: None, body_matches: None, query_param_exists: None, query_param: None, matchers: None }, response: MockServerHttpResponse { status: 201, headers: None, body...
Learn More Rust 2020-09-16 ~11 min read
github.com
...If any of the strings mentioned in `metabuild` do not match one of the build-dependencies, Cargo should produce an error (*before* attempting to generate and compile a `build.rs` script). However, if a string matches a conditional build-dependency, such as one conditional on a feature or target, then...
RFC 2196 RFC 2017-10-31 ~5 min read
aibodh.com
...What’s matches!? The matches! macro checks if a value matches a pattern. matches!(self, CharacterState::Idle) returns true if self is Idle, false otherwise. The | means “or” so matches!(self, CharacterState::Walking | CharacterState::Running) checks if it’s either Walking or Running. Animation Refactoring Now we’ll refactor animation...
Rust Walkthroughs 2025-12-17 ~61 min read
kerkour.com
...handling job({}): {}", job_id, &err); queue.fail_job(job_id).await } }; match res { Ok(_) => {} Err(err) => { println!("run_worker: deleting / failing job: {}", &err); } } }) .await; // sleep not to overload our database tokio::time::sleep(Duration::from_millis(125)).await; } } async fn handle_job(job: Job) -> Result<(), crate::Error> { match job.message...
Rust Walkthroughs 2021-09-08 ~6 min read
xion.io
...Option<String> ) -> Box<Stream<Item=Item, Error=Box<Error>>> { let client = Client::new(handle); Box::new(stream::unfold(after, move |cont_token| { let url = match cont_token { Some(ct) => format!("{}?after={}", URL, ct), None => return None, }; let req = Request::new(Method::Get, url.parse().unwrap()); Some(client.request(req).from...
News & Blog Posts 2018-01-30 ~11 min read
wiredforge.com
...Instead // of having a series of `if`s, we instead use a single `match` statement match v { // if 1, we have a special case, we can return the `Ok` // value with the maximum page size 1 => Ok(PageSize(65_536u32)), // If we find 0 or 2-511, we found and...
Learn Standard Rust 2020-09-16 ~16 min read
git-cliff.org
...See #555 for an example. ✂️ Trim Text​ We changed the commit parser behavior to always trim the text (commit message, body, etc.) before matching it with a regex. This means that you will be able to use $ in the regex for matching until the end. For example: [git]commit_parsers...
Project/Tooling Updates 2024-04-03 ~2 min read
"If you require it, measure it. That's the simple answer. Everything else is guesswork."

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.