Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
docs.rs
...will be matched from the global root (prefix matches). All other paths will be matched as suffix matches. (=<boolean>) : Boolean values may be specified after a parameter, but if not, the value is assumed to be true by virtue of having listed the parameter. Usage with protoc and protoc-gen...
Crate v0.5.0 2025-11-30
github.com
## Summary Make the `count` parameter of `SliceExt::splitn`, `StrExt::splitn` and corresponding reverse variants mean the *maximum number of items returned*, instead of the *maximum number of times to match the separator*. ## Motivation The majority of other languages (see examples below) treat the `count` parameter as the maximum number of...
RFC 979 RFC 2015-03-15 ~2 min read
adventures.michaelfbryan.com
...Axes> System<L, A> for Motion { fn poll(&mut self, inputs: &L, outputs: &mut A) { match self.control_mode { ControlMode::Idle => {} ControlMode::Home(ref mut home) => match home.poll(inputs, outputs) { Transition::Complete => { self.control_mode = ControlMode::Idle } Transition::Fault(_) => { // TODO: we should probably do something about this fault... self...
News & Blog Posts 2019-10-29 ~5 min read
arzg.github.io
...35 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Let’s also extract the parsers for each of the match arms in lhs:fn lhs(p: &mut Parser) -> Option<CompletedMarker> { let cm = match p.peek() { Some(SyntaxKind::Number) => literal(p), Some(SyntaxKind::Ident) => variable_ref(p), Some(SyntaxKind...
Rust Walkthroughs 2020-12-23 ~4 min read
crates.io
...In a regexp without the 'u' flag, these surrogate pairs are matched as distinct characters: const s = "😀"; const re = /./; const m = s.match(re); console.log(m); // returns \uD83D, high surrogate This behavior is almost never desired but is required by the ES spec. It's also super-awkward to...
Crate v0.11.1 2026-03-29
blog.rust.careers
...Pattern matching: The filtered variable is created by using pattern matching to filter out any negative numbers from the input vector. Collecting into a new vector: The squared variable is created by collecting the results of the map function into a new vector. Returning a tuple: The function returns a...
Observations/Thoughts 2024-10-30 ~17 min read
kamalmarhubi.com
...codemap, }; visitor.visit_mod(&krate.module, krate.span, 0); visitor.arg_counts } Rust’s pattern matching really shines when working with ASTs. You can get a small glimpse of it here: we match on the FnKind to see if the function is a method, a free function (ItemFn), or a...
News & Blog Posts 2016-06-06 ~6 min read
diziet.dreamwidth.org
...In particular, although you can specify a pattern to match the arguments to your macro, the pattern matching system has serious limitations (for example, it has a very hard time with Rust’s generic type parameters). Also, you can’t feed existing pieces of your program to a macro without...
Project/Tooling Updates 2023-02-08 ~5 min read
www.sea-ql.org
...DatabaseConnection| { assert!(db.ping().await.is_ok()); db.clone().close().await; assert!(matches!(db.ping().await, Err(DbErr::ConnectionAcquire)));} #1708 Added TryInsert that does not panic on empty inserts​ // now, you can do:let res = Bakery::insert_many(std::iter::empty()) .on_empty_do_nothing() .exec(db) .await;assert!(matches...
Project/Tooling Updates 2023-08-16 ~5 min read
doc.rust-lang.org
...A match expression is made up of arms. An arm consists of a pattern to match against, and the code that should be run if the value given to match fits that arm’s pattern. Rust takes the value given to match and looks through each arm’s pattern in...
The Rust Programming Language Book 2024-02-01 ~27 min read
llogiq.github.io
...We can get rid of those if we encode our atoms as empty enums by relying on the fact that an empty match {} matches all possible values of an empty enum. So if we have enum Foo {} we can write impl<B: Bar> Add<B> for Foo { type Output = ...; fn...
News & Blog Posts 2016-02-29 ~2 min read
dev.to
...After seeing '*', we try to match the rules, and find that it can be matched with First rule of Factor, knowing that '2' is an Factor, we can reduce '2*3' as '6', which is classified as an Factor again. After seeing '/' we try to find the rule, match with...
Learn Simple Rust 2020-10-14 ~7 min read
hacks.mozilla.org
...Here’s a more elaborate look at what happens in the pattern-matching phase of our fizzbuzz example: ... // For pattern matching, we build a tuple, containing // the remainders for integer division of num by 3 and 5 match (num%3, num%5) { // When "num" is divisible by 3 AND 5...
Notable Links 2015-05-18 ~15 min read
hashrust.com
...let browser = match Browser::new(options) { Ok(browser) => browser, Err(e) => { eprintln!("Failed to create browser: {}", e); return; } }; let tab = match browser.wait_for_initial_tab() { Ok(tab) => tab, Err(e) => { eprintln!("Failed to wait for initial tab: {}", e); return; } }; Nothing much to explain here. Then we navigate to the...
Miscellaneous 2022-01-19 ~11 min read
mainmatter.com
...message }] }); let client = Client::new(); let result = client .post("https://api.sendgrid.com/v3/mail/send") .header("Authorization", format!("Bearer {}", api_key)) .header("Content-Type", "application/json") .body(data) .send() .await; match result { Ok(response) => match response.status() { 202 => Response::ok(""), _ => Response::error("Bad Gateway", 502), }, Err(_) => Response::error("Internal...
Rust Walkthroughs 2022-12-14 ~8 min read
serokell.io
...ADTs usually come in a package with pattern matching. Pattern matching Pattern matching is also called “destructuring assignment” in some contexts — usually in languages that don’t have proper sum types, and thus pattern matching essentially boils down to syntactic sugar for extracting fields out of records. There’s also...
Miscellaneous 2025-01-22 ~20 min read
blog.servo.org
...emilio replaced many ad-hoc checks in the CSS selector matching with more structured and consistent logic. rlhunt added support for tiling gradients in WebRender. mrobinson improved the logic for deciding when to clip content. stshine made text correctly inherit overflow properties from its parent element. nox shared more code...
News & Blog Posts 2017-04-11 ~1 min read
blog.nodebb.org
...let mut res = Vec::new(); let mut index = 0; while index < input.len() { match sep.parse(input.slice(index..)) { Err(nom::Err::Error(_)) => { // do-while while { index += 1; !input.is_char_boundary(index) } {} } Err(e) => return Err(e), Ok((rest, mat)) => { // if this match was escaped, skip it if input...
Observations/Thoughts 2020-11-25 ~16 min read
dev.to
...The body syntax is similar to match guard, the Rust equivalent to switch-case statement. This guard is slightly different since it is matching against Rust code. It has one arm in parenthesis ( $( $x:expr),* ) which represents a pattern. If the pattern matches, the code after => will be executed. In...
Learn More Rust 2020-09-23 ~9 min read
doc.rust-lang.org
pub const fn extend(&self, next: Self) -> Result<(Self, usize), LayoutError>
...In order to match C representation layout repr(C), you should call pad_to_align after extending the layout with all fields. (There is no way to match the default Rust representation layout repr(Rust), as it is unspecified.) Note that the alignment of the resulting layout will be the...
method core Stable since 1.44.0 Version 1.100.0-nightly
"Posts like this are useful for those of us who like to help, and who work on rustc to make it more helpful, by letting us learn about what kinds of mi..."

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.