Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
github.com
...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 ~57 min read
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
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
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.17 2023-03-20
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
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
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
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
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
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
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
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
doc.rust-lang.org
...let mut s = String::new(); match process.stdout.unwrap().read_to_string(&mut s) { Err(why) => panic!("couldn't read wc stdout: {}", why), Ok(_) => print!("wc responded with:\n{}", s), } }
Rust by Example Book 2024-01-01 ~1 min read
blog.frankel.ch
...The language models it as an enum with generics on each value: #[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] pub enum Result<T, E> { Ok(T), Err(E), } Because Rust manages completeness of matches, matching on Result enforces that you handle both branches: match fn_that_returns_a_result...
Observations/Thoughts 2024-02-14 ~4 min read
rust-lang.github.io
...rust-lang/rust#44495 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...
Updates from Rust Core 2018-07-03 ~1 min read
www.ntietz.com
...Vec<String>) -> Result<Matches, ParseError> { let mut args_iter = args.into_iter(); let exec_name = match args_iter.next() { Some(s) => s, None => return Err(ParseError::MissingProgramName), }; Next we setup our storage and populate the defaults with our helper function. // pub fn parse(&self, args: Vec<String>) -> Result<Matches, ParseError...
Rust Walkthroughs 2024-11-06 ~11 min read
ntietz.com
...Vec<String>) -> Result<Matches, ParseError> { let mut args_iter = args.into_iter(); let exec_name = match args_iter.next() { Some(s) => s, None => return Err(ParseError::MissingProgramName), }; Next we setup our storage and populate the defaults with our helper function. // pub fn parse(&self, args: Vec<String>) -> Result<Matches, ParseError...
Rust Walkthroughs 2024-11-13 ~11 min read
rodrigodd.github.io
...loop { use Instruction::*; match self.instructions[self.program_counter] { // ... Clear => self.memory[self.pointer] = 0, } // ... } And every time we parse a ] we check if the previous instructions match the “clear cell” operation, and replace it by the new instruction. b']' => { let curr_address = instructions.len(); match bracket_stack.pop() { Some...
Observations/Thoughts 2022-10-26 ~20 min read
llogiq.github.io
...if the closing delimiter is on the same line, ignore both if there is only one opening delimiter on that line, the set only contains the horizontal position of the first non-whitespace character of that line otherwise we need to match the position of the first non-whitespace character...
News & Blog Posts 2016-08-30 ~2 min read
"it's funny, every time I run into a baffling borrow error, it's preventing me from committing a real, serious mistake but it can take some thinking t..."

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.