Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
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
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
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
github.com
...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
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
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
RustWeek www.youtube.com
Martin Larralde -- In a classic case of “Rewrite It In Rust”, implementing a novel algorithm for identifying binding sites in DNA led to a 100x improvement in speed. This talk emphasizes on what made it easier with Rust compared to C & C++, which are still in use predominantly in...
Talk Martin Larralde 2025-05-14
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
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
rust-analyzer.github.io
Rust toolchains newer than 2022-07-29 contain a proc macro server that should be compatible with macros built by the matching compiler. Since today’s release, the server is automatically detected by and used rust-analyzer. This means that, from now on, proc macros will keep working when the...
Project/Tooling Updates 2022-08-03 ~1 min read
danube-docs.dev-state.com
...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
llogiq.github.io
...enum variants, you can also use match, but keep it simple: Only match one thing, and avoid more complex things like guard clauses: // Don't nest patterns in match arms match err_opt_val { Some(Err(e)) => panic!("{e}"), _ => (), } // instead, nest `match` expressions match err_opt_val { Some(err_val...
Observations/Thoughts 2024-04-03 ~16 min read
pythonspeed.com
...def assert_matches(counts1, counts2): """Match A to Z counts.""" for character in 'abcdefghijklmnopqrstuvwxyz': assert counts1[character] == counts2[character] assert_matches( frequency_1(TEXT), frequency_3(TEXT) ) Our new implementation is even faster: Code Elapsed microseconds frequency_2(TEXT) 25,965.5 frequency_3(TEXT) 19,443.5 The Practice...
Observations/Thoughts 2025-07-09 ~14 min read
rreverser.com
...bool> MyEnum<AllowB> { fn is_a(&self) -> bool { match *self { MyEnum::A => true, _ => false, } } } impl MyEnum<true> { // this won't be allowed on MyEnum<false>, giving a helpful compile-time error fn is_b(&self) -> bool { match *self { MyEnum::B => true, _ => false, } } } The first thing that comes to mind is...
News & Blog Posts 2018-01-02 ~5 min read
thefuntastic.com
...This is what the match construct is all about: match item_option { Some(item) => { //Do something with resource println!("{}", item); } None => {}};It's called pattern matching and it's a switch statement, but for types. Here the Some branch is the only code path with a valid reference to item...
Observations/Thoughts 2020-10-28 ~18 min read
github.com
...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
github.com
...Usually, you'll want to copy this value from a corresponding `-fpatchable-function-entry=` being passed to the C compiler in your project - `total_nops` will match the first parameter used by your C compiler, and the optional `offset` parameter passed to the C compiler will match `prefix_nops`. To...
RFC 3543 RFC 2023-12-12 ~12 min read
"You don't declare lifetimes. Lifetimes come from the shape of your code, so to change what the lifetimes are, you must change the shape of the code."

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.