Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
crates.io
A crate of the gitoxide project dealing with pattern matching
Crate v0.27.1 2026-08-22
amanjeev.com
...non-exhaustive patterns: `&_` not covered --> src/main.rs:12:11 | 12 | match place { | ^^^^^ pattern `&_` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = note: the matched value is of type `&str`I do not enjoy writing tests and eating my...
Observations/Thoughts 2020-09-16 ~13 min read
github.com
yap
...let mut current_op = Op::Plus; let mut current_digit = 0; for d in op_or_digit.into_iter() { match d { OpOrDigit::Op(op) => { current_op = op }, OpOrDigit::Digit(n) => { match current_op { Op::Plus => { current_digit += n }, Op::Minus => { current_digit -= n }, Op::Multiply => { current_digit *= n }, } }, } } assert_eq...
Crate v0.12.0 2023-11-18
docs.rs
Diff library with semantic cleanup, based on Google's diff-match-patch
Crate v1.0.11 2026-03-15
ricardoanderegg.com
...usize = if ctx.len() <= arg_cap_group { // no capture group, use default 0 } else { ctx.get(arg_cap_group).context("capture group")? }; // let mut caploc = re.capture_locations(); // re.captures_read(&mut caploc, input_value); if let Some(cap) = re.captures(input_value) { match cap.get(cap_group) { None => empty...
Rust Walkthroughs 2022-05-18 ~10 min read
www.halcyon.hr
...There are several different ways to do this - and it all depends on what you want to do.Pattern matching errorsA simple way of figuring out what’s going on is to use pattern matching on the result type.match how_many_bananas(0) { Ok(number) => println!("You have {} bananas...
News & Blog Posts 2020-06-16 ~13 min read
www.hoverbear.org
...num_read]) .unwrap(); if let Ok(rpc) = json::decode::<RemoteProcedureCall<T>>(data) { match rpc { RemoteProcedureCall::RequestVote(call) => self.handle_request_vote(call, source), RemoteProcedureCall::AppendEntries(call) => self.handle_append_entries(call, source), } } else if let Ok(rpr) = json::decode::<RemoteProcedureResponse>(data) { match rpr { RemoteProcedureResponse::Accepted { .. } => self.handle_accepted(rpr, source...
Blog Posts 2015-02-09 ~5 min read
docs.rs
...loop { for issue in &page { println!("{}", issue.title); } page = match octocrab .get_page::<models::issues::Issue>(&page.next) .await? { Some(next_page) => next_page, None => break, } } HTTP API The typed API currently doesn't cover all of GitHub's API at this time, and even if it did GitHub is...
Crate v0.54.1 2026-07-24
doc.rust-lang.org
...Result<i32, ParseIntError>) { match result { Ok(n) => println!("n is {}", n), Err(e) => println!("Error: {}", e), } } fn main() { print(multiply("10", "2")); print(multiply("t", "2")); } The try! macro Before there was ?, the same functionality was achieved with the try! macro. The ? operator is now recommended, but you may still...
Rust by Example Book 2024-01-01 ~1 min read
relm4.org
...1 2 3 4 5 6 7 8 9 10 11 let component = MyComponent::builder() // Start the component service with an initial parameter .launch("Hello world") // Attach the returned receiver's messages to this closure. .connect_receiver(move |sender, message| match message { // Transform and forward the message Output::HelloThere => { sender...
Project/Tooling Updates 2022-07-27 ~5 min read
iev.ee
nginx/1.28.0
Observations/Thoughts 2026-03-18 ~1 min read
dev.to
...Uuid) -> ApiResponse { let mut v = userdb.db.lock().unwrap(); let users = &mut *v; let pos = users.iter().position(|x| x.id.to_string() == id.to_string()); match pos { Some(p) => { if v[p].match_password(&user.password) { match &user.new_password { Some(passw) => { v[p].update_password(&passw); ApiResponse::ok...
Rust Walkthroughs 2020-11-18 ~18 min read
ruudvanasseldonk.com
...The implementation is a big match statement. For example, this is the check for an if-else expression:let expr_type = match expr { Expr::IfThenElse { condition_span, condition, body_then, body_else, span_then, span_else, .. } => { self.check_expr(type_bool_condition(), *condition_span, condition)?; let type_then = self.check...
Observations/Thoughts 2024-07-24 ~15 min read
asquera.de
...let res = match req { ExampleRequest::Get { url: url } => { match db.get(&url) { Some(v) => ExampleResponse::Ok { content: v.clone() }, None => ExampleResponse::NotFound, } }, ExampleRequest::Post { url: url, content: content } => { match db.insert(url, content) { Some(v) => ExampleResponse::Ok { content: v }, None => ExampleResponse::Ok { content: "".into() }, } } }; println!("Database: {:?}", *db); // Return the result...
News & Blog Posts 2017-03-07 ~26 min read
rustc-dev-guide.rust-lang.org
...Most error annotations need to match with the line of the diagnostic. There are several ways to match the message with the line (see the examples below): β€’ ~: Associates the error level and message with the current line β€’ ~^: Associates the error level and message with the previous error annotation line. Each...
Guide to Rustc Development Book 2024-01-01 ~19 min read
github.com
...We will also query the oauth_github table to see if the crates.io username and GitHub username match. If they do match, we will continue with adding this user as an owner. If they don't match, we will return an error containing information about the mismatch and asking...
RFC 3946 RFC 2026-04-07 ~28 min read
matthewkmayer.github.io
...pub fn generate_source(service: &Service, writer: &mut FileWriter) -> IoResult { match service.protocol() { "json" => generate(writer, service, JsonGenerator, JsonErrorTypes), "query" | "ec2" => generate(writer, service, QueryGenerator, XmlErrorTypes), "rest-json" => generate(writer, service, RestJsonGenerator, JsonErrorTypes), "rest-xml" => generate(writer, service, RestXmlGenerator, XmlErrorTypes), protocol => panic!("Unknown protocol {}", protocol), } } The function signature shows it...
News & Blog Posts 2017-06-27 ~8 min read
calculist.org
...function search(corpus, search) { var ls = lines(corpus); var total = 0; for (var i = 0, n = ls.length; i < n; i++) { total += wcLine(ls[i], search); } return total; } Searching an individual line involves splitting the line up into word and matching each word against the search string: function wcLine(line...
News & Blog Posts 2015-12-28 ~6 min read
developerlife.com
...This combinator takes a range of characters (2, 2) and applies the function match_is_hex_digit to determine whether the char is a hex digit (using is_ascii_hexdigit() on the char). This is used to match a valid hex digit. It returns a &str slice of the matched...
Rust Walkthroughs 2023-05-24 ~20 min read
github.com
...Result<!, E>) -> Self { match x { Err(e) => Err(From::from(e)), } } } ``` But `Option` doesn't need to do anything exciting, so just has a simple implementation, taking advantage of the default parameter: ```rust impl<T> FromResidual for Option<T> { fn from_residual(x: Self::Residual) -> Self { match x { None => None...
RFC 3058 RFC 2020-12-12 ~44 min read
"That said, I really like the language. It’s as if someone set out to design a programming language, and just picked all the right answers. Great eco..."

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.