Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
matthewkmayer.github.io
...let mut connbuilder = SslConnectorBuilder::new(SslMethod::tls()).unwrap(); // https://www.postgresql.org/docs/current/static/libpq-ssl.html describes the modes match dbssl.to_lowercase().as_ref() { "require" | "prefer" | "allow" => connbuilder.set_verify(postgres::tls::openssl::openssl::ssl::SSL_VERIFY_NONE), _ => (), // by default we verify certs: it's like either...
News & Blog Posts 2018-09-18 ~3 min read
ferrous-systems.com
...fill in the match statement below */ /* to make this code compile */ let noise = match animal { /* Cow and Bull */ => { "moo".to_string() } /* Chicken */ => { "cluck, cluck!".to_string() } /* Dog */ => { format!("woof, woof! I am {}!", name) } /* Worm– or all silent animals?*/ => { "-- (silence)".to_string() } }; /* Bonus task: Give Dogs named Lassie */ /* a different output...
Observations/Thoughts 2021-05-05 ~5 min read
dev.to
...String, } Enter fullscreen mode Exit fullscreen mode Now we know we have to match that same error code. Let's find in src/routes/user.rs when we insert a new user: match user_coll.insert_one(document.to_owned(), None) { Ok(inserted) => { match inserted.inserted_id { Some(id) => { ...}, None...
Rust Walkthroughs 2020-12-23 ~12 min read
steveklabnik.com
...At their core, declarative macros allow you to write something similar to a Rust match statement: match x { 4 => println!("four!"), 5 => println!("five!"), _ => println!("something else"), } With match, x’s structure and value will be evaluated, and the right arm will execute based on what matches. So if x...
News & Blog Posts 2017-01-31 ~12 min read
dev.to
...DO NOT USE THIS CODE IN PRODUCTION let url = match json .get(0) .unwrap() .get("data") .unwrap() .get("children") .unwrap() .get(0) .unwrap() .get("data") .unwrap() .get("url") { // Parse the youtube url from the string // "https://www.youtube.com/playlist?list=PLf3u8NhoEikhTC5radGrmmqdkOK-xMDoZ" // after trimming `"` Some(url) => match url::Url...
Learn More Rust 2020-08-11 ~8 min read
tweedegolf.nl
...Next, there is an operation to turn this SIMD mask vector into an integer, resulting in:0b0111 Finally the .trailing_ones method can be used to count how many elements matched before the first one that didn't. For our example it returns 3, and indeed there are 3 matching...
Observations/Thoughts 2025-05-28 ~4 min read
smallcultfollowing.com
...with Thin Traits, you write virtual methods whereas with Extensible Enums, you write match statements – and I think match statements are far more common in Rust today.Still, Thin Traits will be a very good fit for various use cases. They are a good fit for Servo, for example, where...
News & Blog Posts 2015-10-12 ~15 min read
doc.rust-lang.org
...Storing Matching Lines To finish this function, we need a way to store the matching lines that we want to return. For that, we can make a mutable vector before the for loop and call the push method to store a line in the vector. After the for loop, we...
The Rust Programming Language Book 2024-02-01 ~6 min read
codeandbitters.com
...let value = rand::thread_rng().gen(); Self { value } } } Match Ergonomics pattern changes § Lint: rust-2024-incompatible-pat Rust edition guide: Match ergonomics reservations I found this change tricky. I was starting off at a disadvantage, because I didn't know what "match ergonomics" or "binding mode" meant. So the warnings...
Observations/Thoughts 2025-02-12 ~18 min read
zupzup.org
...i32, ) -> Result<Vec<Bytes>> { let https = HttpsConnector::new()?; let client = Client::builder().build::<_, hyper::Body>(https); let group = config.group.as_ref(); let user = config.user.as_ref(); let uri = match group { Some(v) => format!( "https://gitlab.com/api/v4/groups/{}/{}?per_page={}", v, domain, per_page ), None => match user...
News & Blog Posts 2019-11-26 ~10 min read
phildawes.net
...uint, callback: &mut |Match|) { ... } complete_from_file("foo", "myfile.rs", 3, |match| { // do something with each match }); This means the whole search happens regardless of whether you just want the first match. The main reason for doing this is because iterators are somewhat less easy to write for my brain...
Community Updates 2014-05-17 ~5 min read
github.com
...Rust already allows [similar syntax for destructuring in pattern matches](https://doc.rust-lang.org/book/patterns.html#destructuring): a pattern match can use `SomeStruct { field1, field2 } => ...` to match `field1` and `field2` into values with the same names. This RFC introduces symmetrical syntax for initializers. A family of related structures...
RFC 1682 RFC 2016-07-18 ~6 min read
rust-analyzer.github.io
...for fill_match_arms with local enums. #11795 correctly suggest auto importing traits from aliases. #11791 fix and improve signature help. #11802 add stubs to make proc macros work that use the SourceFile API. #11825 don’t complete Drop::drop for qualified paths. #11831 disable ref_match for qualified paths...
Project/Tooling Updates 2022-03-30 ~1 min read
rust-analyzer.github.io
#8611 (first contribution) add support for boolean values to "Fill match arms". #8658 (first contribution) check more carefully for cases when a rename can’t be done. #8582 (first contribution) fix typo in comparison semantic token type. #8600 fix project loading hang. #8606 fix "Registering progress handler" error. #8639 fix...
Project/Tooling Updates 2021-04-28 ~1 min read
www.huy.rocks
...to get the current token is_match(): to check if the current token matched the expected type or not advance(): to consume the current token and move on to the next These methods are not exclusive to a recursive descent parser, but they’re very helpful, as they keep the...
Rust Walkthroughs 2022-05-11 ~6 min read
xnacly.me
...Rust makes this enjoyable via the matches! macro and the patterns the match statement accepts. For instance, checking if the current character is a valid sqlite number can be done by a simple matches! macro invocation:RUST 1/// Specifically matches https://www.sqlite.org/syntax/numeric-literal.html 2fn is...
Rust Walkthroughs 2024-11-06 ~18 min read
fredrik.anderzon.se
...It will print the todos only for the matching filter. We've broken out printing of a single todo item to a print_todo function so that it's easy to call it in several branches of our match statement. Matching on enums is very straight forward as you can...
News & Blog Posts 2016-06-27 ~25 min read
adventures.michaelfbryan.com
...f32) -> Point { let raw = match self.units { Units::Millimetres => Point::new::<millimeter>(x, y, z), Units::Inches => Point::new::<inch>(x, y, z), }; match self.coordinate_mode { CoordinateMode::Absolute => raw, CoordinateMode::Relative => raw + self.current_location, } } fn calculate_feed_rate(&self, command: &GCode) -> Velocity { let raw = match command.value_for...
News & Blog Posts 2019-11-12 ~12 min read
holovskyi.github.io
...client.subscribe("sensors/+/+/temperature", QoS::AtMostOnce).await?; while let Ok(notification) = eventloop.poll().await { match notification { Event::Incoming(Packet::Publish(publish)) => { let parts: Vec<&str> = publish.topic.split('/').collect(); if parts.len() == 4 && parts[0] == "sensors" && parts[3] == "temperature" { let location = parts[1]; let sensor_id = parts[2]; match serde...
Project/Tooling Updates 2026-07-08 ~4 min read
github.com
...This also means that `S{..}` patterns can be used to match structures and variants of any kind. The desire to have such "match everything" patterns is sometimes expressed given that number of fields in structures and variants can change from zero to non-zero and back during development. An extra...
RFC 1506 RFC 2016-02-07 ~5 min read
"This is the first version to have Rust code in it. The public API"
— remains unchanged. Apologies in advance to distros who will have to

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.