Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
docs.rs
A fast library for efficiently matching ignore files such as `.gitignore` against file paths. ignore The ignore crate provides a fast recursive directory iterator that respects various filters such as globs, file types and .gitignore files. This crate also provides lower level direct access to gitignore and file type matchers...
Crate v0.4.35 2026-11-22
www.propelauth.com
...Json<CreateUrl>, ) -> Response { // First grab an auth token from a custom header let token_header = headers.get("X-Auth-Token"); let token = match token_header { None => return (StatusCode::UNAUTHORIZED, "Unauthorized").into_response(), Some(header) => header.to_str().unwrap(), }; // Then verify the token is correct let verify_result = verify_auth_token...
Rust Walkthroughs 2022-12-14 ~7 min read
doc.rust-lang.org
...i32) { // `Option` values can be pattern matched, just like other enums match checked_division(dividend, divisor) { None => println!("{} / {} failed!", dividend, divisor), Some(quotient) => { println!("{} / {} = {}", dividend, divisor, quotient) }, } } fn main() { try_division(4, 2); try_division(1, 0); // Binding `None` to a variable needs to be type annotated let none: Option...
Rust by Example Book 2024-01-01 ~1 min read
bitfieldconsulting.com
...let weather = ws.get_weather("New York City,USA").unwrap(); This won’t match what the mock server expects, so naturally enough we get a failure: called `Result::unwrap()` on an `Err` value: bad response: {"message":"Request did not match any route or mock"} The “bad response” part tells us...
Rust Walkthroughs 2026-05-13 ~8 min read
docs.rust-embedded.org
...Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v27 API v2 SWIM v15 VID 0x0483 PID 0x374B Info : using stlink api v2 Info : Target voltage: 2.919881 Info...
The Embedded Rust Book Book 2024-01-01 ~2 min read
dwrensha.github.io
...address_book::Reader) -> ::std::result::Result<(), ::capnp::Error> { for person in try!(address_book.get_people()).iter() { println!("{}: {}", try!(person.get_name()), try!(person.get_email())); for phone in try!(person.get_phones()).iter() { let type_name = match phone.get_type() { Ok(person::phone_number::Type::Mobile) => "mobile", Ok(person...
Project Updates 2015-03-23 ~1 min read
auroranssolis.github.io
...We’ll do this by seeing whether a multiple of two metavariables needs a leading metavariable in order to match. macro_rules! luhn { // Matches: // - a // - a b c // - ... ($head:tt $($tail1:tt $tail2:tt)*) => { calculate_residue!([$head $($tail1 $tail2)*] [odd] [even] [0]) }; // Matches: // - // - a b // - ... ($($tail1:tt $tail2:tt)*) => { calculate...
Rust Walkthroughs 2024-02-21 ~15 min read
adventures.michaelfbryan.com
...In this case parameters, constants, and function calls all have the highest possible precedence level. // src/expr.rs impl Expression { fn precedence(&self) -> Precedence { match self { Expression::Parameter(_) | Expression::Constant(_) | Expression::FunctionCall { .. } => Precedence::Bi, Expression::Negate(_) => Precedence::Md, Expression::Binary { op, .. } => op.precedence(), } } } impl BinaryOperation { fn precedence(self) -> Precedence { match...
News & Blog Posts 2020-07-14 ~25 min read
adventures.michaelfbryan.com
...In this case parameters, constants, and function calls all have the highest possible precedence level. // src/expr.rs impl Expression { fn precedence(&self) -> Precedence { match self { Expression::Parameter(_) | Expression::Constant(_) | Expression::FunctionCall { .. } => Precedence::Bi, Expression::Negate(_) => Precedence::Md, Expression::Binary { op, .. } => op.precedence(), } } } impl BinaryOperation { fn precedence(self) -> Precedence { match...
News & Blog Posts 2020-07-21 ~25 min read
recursion.wtf
...let layer = match seed { ExprBoxed::Add { a, b } => ExprLayer::Add { a, b }, ExprBoxed::Sub { a, b } => ExprLayer::Sub { a, b }, ExprBoxed::Mul { a, b } => ExprLayer::Mul { a, b }, ExprBoxed::LiteralInt { literal } => ExprLayer::LiteralInt { literal: *literal }, }; This matches on seed, a value of type &ExprBoxed, and consumes it to create layer...
Rust Walkthroughs 2022-07-20 ~13 min read
docs.rs
...server.expect( Expectation::matching(request::method_path("GET", "/foo")).respond_with(status_code(200)), ); // Configure the server to also receive between 1 and 3 POST /bar requests // with a json body matching {'foo': 'bar'}, and respond with a json body // {'result': 'success'} server.expect( Expectation::matching(all_of![ request::method...
Crate v0.16.4 2026-01-06
sireliah.com
...6 nodes.sort_by(|a, b| b.prob.partial_cmp(&a.prob;).unwrap()); 7 8 let first = match nodes.pop() { 9 Some(i) => i,10 None => return,11 };12 13 let second: Node = match nodes.pop() { 14 Some(i) => i,15 None => return,16 };17 18 /// Create new node and...
News & Blog Posts 2017-06-27 ~8 min read
kerkour.com
...Then we can handle a potential error with match. fn question() -> Result<(), Error> { let x = // ... match ultimate_answer(x) { Ok(_) => // do something Err(Error::More) => // do something Err(Error::Less) => // do something Err(Error::WrongAnswer) => // do something } // ... } Or, the most common way to handle errors, forward them with ?. fn question...
Observations/Thoughts 2022-02-09 ~4 min read
www.bekk.christmas
...Then we pattern match on the vector as a slice – a view into an array.When the compiler sees a match expression, it matches the value with the list of patterns and stops when encountering the first pattern that matches. Each branch has the form of SomePattern => some_expression(),. For...
Rust Walkthroughs 2022-12-07 ~17 min read
akesson.io
...Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { loop { match *self { Start { who } => { println!("ready…"); *self = AwaitingSleep { … }; } // the .await: poll the child… AwaitingSleep { sleep, who } => match sleep.poll(cx) { // …on Pending, return Pending yourself // return Pending yourself Pending => return Pending, // loop iteration 1 Ready(_) => { // loop iteration 1 println!("hi {who}!"); *self...
Rust Walkthroughs 2026-09-16 ~82 min read
crates.io
...use jiff::{ToSpan, Zoned}; use parse_datetime::{parse_datetime_at_date, ParsedDateTime}; let now = Zoned::now(); let after = parse_datetime_at_date(now.clone(), "+3 days"); match after.unwrap() { ParsedDateTime::InRange(z) => assert_eq!(now.checked_add(3.days()).unwrap(), z), ParsedDateTime::Extended(_) => unreachable!("unexpected for this input"), } For DateTime...
Crate v0.18.0 2026-11-22
bertptrs.nl
...my_print!(match) would not be accepted. Edition 2024 brings the :tt fragment specifier up-to-date with the new additions to the language, allowing it to match _- and const expressions as part of an :expr fragment. If you must maintain the previous behaviour, you can replace :expr with :expr...
Observations/Thoughts 2025-02-26 ~17 min read
rust-lang.github.io
...This lint warns when you use print!() with a format string that ends in a newline. • match_ref_pats: Checks for matches where all arms match a reference, suggesting to remove the reference and deref the matched expression instead. It also checks for if let &foo = bar blocks. • ptr_arg...
RFC 2476 RFC 2018-06-14 ~30 min read
blog.logrocket.com
...Declarative macros provide a match like an interface where on match the macro is replaced with code inside the matched arm. Creating declarative macros // use macro_rules! <name of macro>{<Body>} macro_rules! add{ // macth like arm for macro ($a:expr,$b:expr)=>{ // macro expand to this code { // $a and...
Rust Walkthroughs 2021-02-03 ~17 min read
crates.io
...When the specified expectations do not match the received request, mock.assert() fails the test with a detailed error description, including a diff that shows the differences between the expected and actual HTTP requests. Example: 0 of 1 expected requests matched the mock specification. Here is a comparison with the...
Crate v0.9.0 2026-10-20
"There are many ways in which Rust is like a version of C/C++ that mutated when Haskell was injected into its veins."

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.