Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
arzg.github.io
...How is the parser meant to manage expected_kinds if it can’t know which arm of the match is being run and which ones have been tried before? We’ll have to convert all these matches to if else chains that use Parser::at.To ensure we don’t...
Rust Walkthroughs 2020-12-23 ~30 min read
arzg.github.io
...First, we’ll determine which particular operator we’re looking at:pub(super) fn expr(p: &mut Parser) { match p.peek() { Some(SyntaxKind::Number) | Some(SyntaxKind::Ident) => p.bump(), _ => {} } let op = match p.peek() { Some(SyntaxKind::Plus) => Op::Add, Some(SyntaxKind::Minus) => Op::Sub, Some(SyntaxKind::Star) => Op::Mul, Some...
Rust Walkthroughs 2020-11-18 ~27 min read
vincents.dev
...std::num::ParseIntError) -> Self { DemoError::ParseErr(error) } } impl Error for DemoError {} impl Display for DemoError { fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> { match self { DemoError::ParseErr(error) => write!( f, "error parsing with {}", error.to_string() ), } } } fn my_function() -> Result<(), DemoError> { let first_input = "3^"; let my_number...
Rust Walkthroughs 2025-12-31 ~9 min read
arzg.github.io
...We should also define a proper format for displaying Vals so we can customise how they appear:// crates/eldiro/src/val.rs use std::fmt; // snip impl fmt::Display for Val { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Number(n) => write!(f, "{}", n), Self::Unit...
Learn More Rust 2020-10-07 ~13 min read
danube-docs.dev-state.com
...Pattern Matches "payment" Exact match only "ship*" "shipping", "shipment", etc. "eu-west-?" "eu-west-1", "eu-west-2", etc. "*" Everything (same as no filter) Glob matching is implemented with an iterative backtracking algorithm (simple_glob) that handles * and ? without regex overhead. If a message's routing key matches no consumer...
Project/Tooling Updates 2026-04-22 ~8 min read
timryan.org
...But we lack one important aspect of Rust’s pattern matching capabilities: its requirement that all match arms must be “exhaustive” (that is, there are no unhandled cases). If we matched against the FrontendMessage enum type, but we only handled the Init and ButtonState variants, our program would fail at...
News & Blog Posts 2019-01-29 ~9 min read
quickwit.io
...a RegexPhraseQuery "b.* b.* wolf" matches "big bad wolf". Slop is supported as well: "bi.* wolf"~2 matches "big bad wolf". #2516This feature comes with some new Postings implementations to handle the complexity of potentially 100000 terms. They may be useful for other use cases:SimpleUnion A union docset for...
Project/Tooling Updates 2025-06-25 ~3 min read
cglab.ca
...Ord, V> Map<K, V> for BTreeMap<K, V> { fn find(&self, key: &K) -> Option<&V> { let mut cur_node = &self.root; loop { match cur_node.search(key) { Found(i) => return cur_node.val(i), GoDown(i) => match cur_node.edge(i) { None => return None, Some(next_node) => { cur_node...
Observations/Thoughts 2021-02-03 ~35 min read
rust-analyzer.github.io
#10608 (first contribution) amend the rustup installation instructions. #10574, #10578 fix "Generate PartialOrd implementation" codegen. #10568 improve codegen for "Unwrap Result return type". #10585 resolve derive attributes even when shadowed. #10587 fix add_missing_match_arm panicking on failed upmapping. #10589 expand unused glob import into {}. #10594 generate and complete...
Project/Tooling Updates 2021-10-27 ~1 min read
pietro.menna.net.br
...PeerMessage) -> Result<(), Error> { match message { PeerMessage::CancelRequest(piece_index, block_index) => { match self.requests_in_progress.iter().position(|r| r.matches(piece_index, block_index)) { Some(i) => { let r = self.requests_in_progress.remove(i); self.send_message(Message::Cancel(r.piece_index, r.offset, r.block_length)) }, None => Ok...
From the Blogosphere 2015-06-22 ~7 min read
ibraheem.ca
...Like a match statement, but for I/O operations. loop { // If only... match { ctrl_c() => { break; }, Ok((connection, _)) = listener.accept() => { std::thread::spawn(|| ...); } } } And what about timing out long running requests after thirty seconds? We could set a flag that tells threads to stop, but how often would they check...
Observations/Thoughts 2023-08-16 ~88 min read
aturon.github.io
...DomString) -> AttrValue { match name { &atom!("id") => AttrValue::from_atomic(value), &atom!("class") => AttrValue::from_serialized_tokenlist(value), _ => default::parse_plain_attribute(self, name, value), } } } impl ParsePlainAttribute for HtmlAnchorElement { fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue { match name { &atom!("rel") => AttrValue::from_serialized_tokenlist(value), _ => default::parse_plain...
News & Blog Posts 2015-09-21 ~24 min read
rust-analyzer.github.io
...trying to use an uncached syntax node in Semantics. #10460 only add proc_macro to prelude in proc-macro crates. #10477 fix parsing of macro call inside generic args. #10449 fix parsing of Some(1..). #10420 parse outer attributes on StructPatternEtCetera. #10480 change snake case fix to match rustc implementation.
Project/Tooling Updates 2021-10-13 ~1 min read
www.snoyman.com
...f64, } #[derive(Clone, Copy)] enum State { Arizona, Nevada, Utah, } impl State { fn tax_rate(self) -> f64 { match self { State::Arizona => 0.05, State::Nevada => 0.08, State::Utah => 0.09, } } } #[derive(Clone, Copy)] enum Item { Apples, Eggs, } impl Item { fn price(self) -> f64 { match self { Item::Apples => 0.5, Item...
Rust Walkthroughs 2024-08-28 ~10 min read
matthewkmayer.github.io
...fn make_org_url(matches: &clap::ArgMatches) -> String { let org = matches .value_of("ORG") .expect("Please specify a github org"); if !org_is_just_org(&org) { match suggest_org_arg(&org) { Ok(suggestion) => panic!("Try this for the org value: {}", suggestion), Err(_) => panic!("Please make org just the organization name...
News & Blog Posts 2017-10-24 ~6 min read
www.fpcomplete.com
...So let's rewrite this without any early return, and instead use some pattern matching: fn age() -> Option<i32> { match (birth_year(), current_year()) { (Some(birth_year), Some(current_year)) => Some(current_year - birth_year), _ => None, } } This certainly works, but it's verbose. It also doesn't generalize to other...
Observations/Thoughts 2020-12-09 ~22 min read
dystroy.org
...Result<T, E>) -> T { match res { Ok(v) => v, Err(e) => { log::error!("Fatal error: {}", e); Timer::after_millis(100).await; panic!("Fatal error: {}", e); } } } #[embassy_executor::main] async fn main(spawner: Spawner) { let p = embassy_rp::init(Default::default()); // Logger USB — must be before everything else let usb_driver...
Rust Walkthroughs 2026-06-17 ~50 min read
rust-analyzer.github.io
#12382 make auto-closing angle brackets configurable, disabled by default. #12341 make files.excludeDirs work. #12355 fix inference when pattern matching a tuple field with a wildcard. #12409 fix overflow during type inference for tuple struct patterns. #12384, #12386 Generate variant: insert code in file with enum definition. #12370 insert...
Project/Tooling Updates 2022-06-01 ~1 min read
github.com
...The effect will be to convert uses of arrays such as this: ```rust let a: [uint, ..2] = [0u, ..2]; ``` to this: ```rust let a: [uint; 2] = [0u; 2]; ``` ### Match patterns In match patterns, `..` is always interpreted as a wildcard for constructor arguments (or for slice patterns under the `advanced_slice...
RFC 520 RFC 2014-12-13 ~5 min read
www.worthe-it.co.za
...It follows that the lifetime of variables used inside the new thread must match those of the new thread, not the function that it was spawned from.use std::thread; let outside_value = String::from("Hello world"); let child_thread = thread::spawn(move || { // this new thread may outlive the context...
News & Blog Posts 2017-07-18 ~10 min read
"**Real Question:** is an array a struct/tuple, or is it an enum?"

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.