Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
acv.engineering
...The match flow keyword allow you to match on a variable, in this case, since I’m matching what’s passed into the CLI opt.cmd, and if command matches play, then call the play_file public function from play_loop and pass in the String that was passed in...
Rust Walkthroughs 2021-11-03 ~8 min read
docs.rs
...Test pattern matches: assert!(let Err(e) = File::open("/non/existing/file")) . Use let chains (even with compilers older than Rust 1.88). See which part of a && chain failed. Re-use captured variables from pattern matches in later code with assert!(...) . Perform multiple checks before panicking with check!(...) . Colored...
Crate v0.4.1 2026-09-09
tavianator.com
...Metric<T> = T> { /// Returns the nearest match to `target` (or `None` if this index is empty). fn nearest(&self, target: &U) -> Option<Neighbor<&T>>; /// Returns the nearest match to `target` within the `threshold`, if one exists. fn nearest_within(&self, target: &U, threshold: f64) -> Option<Neighbor<&T>>; /// Returns the up...
News & Blog Posts 2020-05-27 ~10 min read
docs.rs
...It offers means to match your type's signature - <T as zvariant::Type>::signature() - with a corresponding signature retrieved from a DBus XML file. This way zbus-lockstep prevents definitions from drifting apart. Motivation In the context of IPC over DBus - especially when there are multiple implementations of servers and...
Crate v0.8.0 2026-11-16
therohansharma.com
...fn extract_entities(tree: &Tree, source: &str) -> Vec<SemanticEntity> { let mut cursor = tree.root_node().walk(); let mut entities = Vec::new(); for node in tree.root_node().children(&mut cursor) { match node.kind() { "function_item" | "function_definition" => { entities.push(build_entity(node, source, "function")); } "class_definition" | "impl_item" => { let class...
Project/Tooling Updates 2026-04-22 ~13 min read
natkr.com
...FairDice, } impl SimpleFuture<u8> for LoadedDice { fn poll(&mut self) -> Poll<u8> { match self.inner.poll() { Poll::Ready(x) => Poll::Ready(x + 1), Poll::Pending => Poll::Pending, } } } Now.. writing all those "match poll, if pending then return, if ready then continue" blocks can also get pretty tedious. Thankfully, Rust provides...
Rust Walkthroughs 2025-04-16 ~10 min read
rust-lang.github.io
...Only types which have the "structural match" property can be used as const parameters. This would exclude floats, for example. The structural match property is intended as a stopgap until a final solution for matching against consts has been arrived at. It is important for the purposes of type equality...
RFC 2000 RFC 2017-05-01 ~11 min read
rust-lang.github.io
...The compiler's searching and file matching logic would be altered to only match crates based on name. If two versions of a crate are found, the compiler will unconditionally emit an error. It will be up to the user to move the two libraries on the filesystem and control...
RFC 109 RFC 2014-06-24 ~7 min read
fitzgeraldnick.com
...bz_stream = mem::zeroed(); let result = BZ2_bzCompressInit(&mut stream as *mut _, 1, // 1 x 100000 block size 4, // verbosity (4 = most verbose) 0); // default work factor match result { r if r == (BZ_CONFIG_ERROR as _) => panic!("BZ_CONFIG_ERROR"), r if r == (BZ_PARAM_ERROR as _) => panic!("BZ_PARAM...
News & Blog Posts 2016-12-20 ~9 min read
simplabs.com
...base64::Config = match_config(opt); let bytes = base64::decode_config(b64, config).expect("decode failed: invalid b64"); String::from_utf8(bytes).unwrap() } #[rustler::nif] pub fn encode(s: String, opt: Atom) -> String { let config: base64::Config = match_config(opt); base64::encode_config(s.as_bytes(), config) } fn match_config(option...
News & Blog Posts 2020-07-14 ~5 min read
jorgeortiz.dev
...So we used the matches!() macro inside the assertion to verify this use case. The expression used was assert!(matches!(...));, that is not as clarifying as it could be. I have used similar expressions for quite a while, but I was secretly hoping that assert_matches!() would become part of...
Rust Walkthroughs 2025-11-19 ~13 min read
doc.rust-lang.org
pub const unsafe fn swap<T>(x: *mut T, y: *mut T)
...to them be `[2, 3]`, so that indices `0..3` are // `[1, 2, 3]` (matching `y` before the `swap`); or for them to be `[0, 1]` // so that indices `1..4` are `[0, 1, 2]` (matching `x` before the `swap`). // This implementation is defined to make the latter choice. assert...
function core Stable since 1.0.0 Version 1.100.0-nightly
dev.to
...Self::Message) -> ShouldRender { match msg { Msg::Increment => self.value += 1, Msg::Decrement => self.value -= 1, } true } fn change(&mut self, _props: Self::Properties) -> ShouldRender { false } fn view(&self) -> Html { html! { <div> <button onclick=self.link.callback(|_| Msg::Increment)>{"+"}</button> <span style="width: 50px">{ self.value }</span> <button onclick=self.link...
Rust Walkthroughs 2020-11-25 ~5 min read
doc.rust-lang.org
...This can be matched as shown below, or used with // `.expect()` if you would like the program to exit with a nice // message instead of happily continue. for i in 0..xs.len() + 1 { // Oops, one element too far! match xs.get(i) { Some(xval) => println!("{}: {}", i, xval), None => println...
Rust by Example Book 2024-01-01 ~2 min read
arzg.github.io
...SyntaxNode) -> Option<Self> { let result = match node.kind() { SyntaxKind::InfixExpr => Self::BinaryExpr(BinaryExpr(node)), SyntaxKind::Literal => Self::Literal(Literal(node)), SyntaxKind::ParenExpr => Self::ParenExpr(ParenExpr(node)), SyntaxKind::PrefixExpr => Self::UnaryExpr(UnaryExpr(node)), SyntaxKind::VariableRef => Self::VariableRef(VariableRef(node)), _ => return None, }; Some(result) } } We’re still missing an AST node, namely...
Rust Walkthroughs 2021-01-27 ~21 min read
sabrinajewson.org
...We have to match on the Result for that:let blocks = match Blocks::from_file("Blocks.txt") { Ok(blocks) => blocks, Err(unicode_blocks::Error::Io(e)) if e.kind() == io::ErrorKind::NotFound => { } }; Great! But the compiler is yelling that the match arms aren’t exhaustive. Not too hard to fix...
Observations/Thoughts 2023-04-12 ~23 min read
crates.io
...u32) -> u32 { match n { 1 | 2 => 1, _ => fibonacci_native(n - 1) + fibonacci_native(n - 2), } } #[napi] fn get_cwd<T: Fn(String) -> Result<()>>(callback: T) { callback(env::current_dir().unwrap().to_string_lossy().to_string()).unwrap(); }
Crate v3.7.2 2026-11-23
www.joshmcguigan.com
...fn main(){ loop { print!("> "); stdout().flush(); let mut input = String::new(); stdin().read_line(&mut input).unwrap(); let mut parts = input.trim().split_whitespace(); let command = parts.next().unwrap(); let args = parts; match command { "cd" => { // default to '/' as new directory if one was not provided let new_dir = args.peekable...
News & Blog Posts 2018-11-20 ~7 min read
danube-docs.dev-state.com Archived: primary link replaced with an archive on 2026-09-12T11:22:11.522Z (UTC; replacement date, not snapshot date)
...Subsequent producers must use the same subject: // First producer - assigns schema subject to topic let first = client.producer() .with_topic("new-topic") .with_schema_subject("user-events") // ✅ Sets topic's schema .build(); // Second producer - must match let second = client.producer() .with_topic("new-topic") .with_schema_subject("user-events") // ✅ Matches...
Project/Tooling Updates 2026-01-07 ~10 min read
rust-analyzer.github.io
New Features #6645 add diagnostics for unexpandable macros. #6666 support "go to definition" for self parameter. #6664 show type of self on hover. #6606 support unsafe extern block syntax. #6618, #6621 type inference for tuple patterns with ellipsis. #6624 check structs for match exhaustiveness. #6631 gate autoimports behind experimental completions...
Tooling 2020-12-02 ~1 min read
"\[W\]e reached a tipping point. **We decided to move our entire codebase to Rust**... . Rust seemed to give us all the capabilities we needed, **howev..."

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.