Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
pub macro unreachable!
...Examples Match arms: fn foo(x: Option<i32>) { match x { Some(n) if n >= 0 => println!("Some(Non-negative)"), Some(n) if n < 0 => println!("Some(Negative)"), Some(_) => unreachable!(), // compile error if commented out None => println!("None") } } Iterators: fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations...
macro core Stable since 1.0.0 Version 1.100.0-nightly
rust-lang.github.io
...DefId) -> ParamEnv<'tcx> { if tcx.describe_def(def_id) match Some(Def::Existential(_)) && tcx.hir.as_local_node_id(def_id) match Some(node_id) && tcx.hir.get(node_id) match hir::map::NodeItem(item) && item.node match hir::ItemExistential(ref exist_ty) && exist_ty.impl_trait_fn match Some...
RFC 2497 RFC 2018-07-13 ~54 min read
thesquareplanet.com
...You may be tempted to write code like this let mut v = foo(); match v { Enum::Bar(ref mut x) => { x += 1; }, Enum::Baz(ref mut y) => { y -= 1; }, _ => (), // needed to make pattern exhaustive }; v But match can make this much nicer: match foo() { Enum::Bar(x) => Enum::Bar(x...
Blog Posts 2016-10-25 ~8 min read
bal-e.org
...you need to match the input (a, b) against the match arms in foo (“parsing”); then you need to compute the output by filling in meta-variables in the match arm body (“transcribing”). r-a’s mbe/expander/matcher.rs, which implements the parsing step, has a top-level comment...
Rust Walkthroughs 2026-05-06 ~10 min read
doc.rust-lang.org
pub fn rsplit_terminator<P>(&self, pat: P) -> RSplitTerminator<'_, P>
str::rsplit_terminator — Returns an iterator over substrings of self, separated by characters matched by a pattern and yielded in reverse order. The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character matches. Equivalent to split, except that the...
method core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub type Result<T> = crate::result::Result<T, Box<dyn Any + Send + 'static>>
...or in case the thread is intended to be a subsystem boundary that is supposed to isolate system-level failures, match on the Err variant and handle the panic in an appropriate way A thread that completes without panicking is considered to exit successfully. Examples Matching on the result of...
type_alias std Stable since 1.0.0 Version 1.100.0-nightly
github.com
...must_match takes 1 string argument. It will error if the field mentioned is missing or has a different type than the field the attribute is on. Examples: #[validate(must_match = "password2")] #[validate(must_match(other = "password2"))] contains Tests whether the string contains the substring given or if a key...
Crate v0.16.0 2022-07-25
paulkoerbitz.de
...When we apply `match` to a dereferenced borrowed pointer, we cannot move because we don't have ownership. Changing the `match_and_print` function to take a value would work again. ~~~{.rust} fn match_and_print(e: MyEnum) { match e { MyEnum::X(x) => println!("{}", x), MyEnum::Y(y) => println!("{}", *y...
Announcements, etc 2014-01-18 ~13 min read
owengage.com
...We can match on this to call the appropriate visitor methods. Here is a cut down version of deserialize_any: fn deserialize_any<V>(mut self, v: V) -> Result<V::Value> where V: de::Visitor<'de>, { match self.tag { Tag::Byte => v.visit_i8(self.de.input.consume_byte()? as...
Rust Walkthroughs 2022-08-10 ~7 min read
dev.to
...When both maps build successfully, matching elements is a direct lookup. Matching objects are diffed recursively, missing items are reported as insertions or deletions, and the key is incorporated into the output path: containers[name=api].image instead of containers[1].image. The total time complexity is O(n log...
Rust Walkthroughs 2026-09-23 ~5 min read
micahkepe.com
...Dots (.) between field names denote concatenation-- "match this field, then that field":$ cat sample.json | jg 'roommates[0].name' roommates.[0].name: "Alice"BashWildcards match any single key (*) or any array index ([*]):$ cat sample.json | jg 'favorite_drinks[*]' favorite_drinks.[0]: "coffee" favorite_drinks.[1]: "Dr. Pepper" favorite_drinks.[2...
Project/Tooling Updates 2026-04-01 ~13 min read
rust-lang.github.io
Summary Currently when using an if let statement and an irrefutable pattern (read always match) is used the compiler complains with an E0162: irrefutable if-let pattern. The current state breaks macros who want to accept patterns generically and this RFC proposes changing this error to an error-by-default...
RFC 2086 RFC 2017-07-27 ~1 min read
doc.rust-lang.org
pub struct MatchIndices<'a, P>
MatchIndices — Created with the method match_indices.
struct core Stable since 1.5.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn rsplit<P>(&self, pat: P) -> RSplit<'_, P>
str::rsplit — Returns an iterator over substrings of the given string slice, separated by characters matched by a pattern and yielded in reverse order. The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character matches. Iterator behavior The returned...
method core Stable since 1.0.0 Version 1.100.0-nightly
blog.datalust.co
...let index_quote = { let match_quote = _mm256_cmpeq_epi8(block, _mm256_set1_epi8(b'"' as i8)); let index_quote = _mm256_movemask_epi8(match_quote); let match_escape = _mm256_cmpeq_epi8(block, _mm256_set1_epi8(b'\\' as i8)); let index_escape = _mm256_movemask_epi8(match_escape); index_quote | index_escape }; The...
Learn More Rust 2020-09-09 ~20 min read
doc.rust-lang.org
pub fn split_terminator<P>(&self, pat: P) -> SplitTerminator<'_, P>
str::split_terminator — Returns an iterator over substrings of the given string slice, separated by characters matched by a pattern. The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character matches. Equivalent to split, except that the trailing substring...
method core Stable since 1.0.0 Version 1.100.0-nightly
docs.rs
Strongly Typed Mimes mime Support MIME (Media Types) as strong types in Rust. Documentation Usage extern crate mime; // common types are constants let text = mime::TEXT_PLAIN; // deconstruct Mimes to match on them match (text.type_(), text.subtype()) { (mime::TEXT, mime::PLAIN) => { // plain text! }, (mime::TEXT, _) => { // structured text! }, _ => { // not text! } }
Crate v0.3.18 2026-11-05
blog.sylver.dev
...Token) -> bool { self.tokens.get(self.pos) == Some(&expected) } fn expect_identifier(&mut self) -> anyhow::Result<&str> { self.expect_matching(|t| matches!(t, Token::Identifier(_))) .map(|t| t.as_identifier().unwrap()) } fn expect_eq(&mut self, expected: Token) -> anyhow::Result<&Token> { self.expect_matching(|t| *t == expected) } fn expect_matching...
Rust Walkthroughs 2024-11-20 ~9 min read
ck.kennt-wayne.de
...let mut result = match results.get_mut(i) { Some(v) => v, None => panic!("error! no value!") }; The return value of get_mut() is just an enum, but in Rust enums may contain additionally a value. This leads to constructs like above. The match keyword introduces a pattern matching construct and...
Blog Posts 2015-01-05 ~5 min read
crates.io
...dev is fuzzy local versions on top of all the others, which are added with a + and have implicitly typed string and number segments no semver-caret ( ^ ), but a pseudo-semver tilde ( ~= ) ordering contradicts matching: We have e.g. 1.0+local > 1.0 when sorting, but ==1.0 matches...
Crate v0.7.3 2024-12-04
"I'll know ide support is mature when the flame wars start."
— Unnamed friend of arthrowpod

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.