Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
www.simonclark.dev
...Vec<u32>, } pub fn solve_sudoku(input: &mut Sudoku) -> bool { match find_first_empty(&input.board) { None => true, Some((row, col)) => { for option in options_for(&input.board, row, col){ let idx = (row * 9 + col) as usize; input.board[idx] = option; if solve_sudoku(input) { return true; } input.board[idx...
Observations/Thoughts 2021-04-21 ~5 min read
fasterthanli.me
...non-exhaustive patterns: `5u16..=std::u16::MAX` not covered --> src/lib.rs:17:15 | 17 | match x { | ^ pattern `5u16..=std::u16::MAX` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms To deal with that possibility, we could return an...
News & Blog Posts 2020-02-25 ~29 min read
blog.lilyf.org
...swapped_context }; let cloned = py_context.clone(); let content = self.func.call1( py, (cloned,)?; let inner_context = match Arc::try_unwrap( py_context.context) { Ok(inner_context) => { inner_context } Err(_) => todo!(), }; let _ = std::mem::replace( context, inner_context); Ok(content.to_string()) } } } This works great when Python doesn’t keep...
Rust Walkthroughs 2025-09-03 ~5 min read
trifectatech.org
...allow unaligned reads in longest_match wasm: SIMD adler32 wasm: SIMD slide_hash wasm: use wider loads/stores in copy_match wasm: SIMD compare256 Decompression implementationspeedup (wall time) baseline-41.1% miniz-oxide-54.9% zlib-ng-25.3% Our optimizations made our implementation over 40% faster; we're now...
Observations/Thoughts 2024-11-20 ~3 min read
noyez.gitlab.io
...Deserializer<'de> { match MacOrU64::deserialize(deserializer)? { MacOrU64::U64(v) => { Ok(v) } MacOrU64::Mac(v) => { mac_addr_as_u64(&v).ok_or(serde::de::Error::custom("Can't parse MAC address")) } } } Note the #[serde(untagged)] attribute which makes the serialized JSON an anonymous object. See the serde documentation for serge’s...
News & Blog Posts 2018-09-04 ~3 min read
219design.com
...Example match block!(bnrg.with_spi(&mut spi, |c| c.read())) { Ok(p) => { let hci::host::uart::Packet::Event(e) = p; match e { bluetooth_hci::event::Event::ConnectionComplete(params) => { // handle the new connection } bluetooth_hci::event::Event::Vendor( bluenrg::event::BlueNRGEvent::HalInitialized(reason), ) => { // handle the BlueNRG chip reset } _ => (), } } Err(e...
News & Blog Posts 2018-10-09 ~12 min read
doc.rust-lang.org
...missing fragment specifier } fn main() { foo!(); } Calling the macro with arguments that would match a rule with a missing specifier (e.g., foo!($name)) was a hard error in all editions. However, simply defining a macro with missing fragment specifiers was not, though we did add a lint in Rust...
The Rust Edition Guide Book 2024-01-01 ~1 min read
rust.code-maven.com
...For example by using match and handling the Ok and Err cases separately. Inside the prompt function we don't have any explicit error handling. We just added ? at the end of the calls that might fail. This means if either of those calls fail, the prompt function immediately returns...
Miscellaneous 2024-01-03 ~3 min read
blog.japaric.io
...a task token whose type must match the interrupt field of the declaration, a priority token whose type must match the priority field of the declaration, and a threshold token whose type must match the level of the priority token. The priority and threshold tokens we have already seen. The...
News & Blog Posts 2017-05-09 ~37 min read
nadrieril.github.io
...let tmp = x.method(); something(&tmp.field); This is exactly what we need for postfix macros: <expr>.macro!() would become (using a match to make the temporary lifetimes work as they should 🤞): match <expr> { place p => macro!(p), } This would have the effect I propose above: any side-effects...
Observations/Thoughts 2025-12-10 ~8 min read
rustacean-station.org
...hello@rustacean-station.org Timestamps & referenced resources 03:05 - RPIT lifetime capture rules 08:00 - let chains in if and while if let temporary scope Mara’s post on “super let” Tail expression temporary scope 19:15 - Match ergonomics reservations 24:49 - Unsafe extern blocks 29:15 - Unsafe attributes 32...
Observations/Thoughts 2026-02-04 ~1 min read
www.sea-ql.org
...common-async-runtime/async_std_task.rs/// A shim to match tokio's APIpub struct TaskHandle<T>(async_std::task::JoinHandle<T>);pub fn spawn_task<F, T>(future: F) -> TaskHandle<T>where F: Future<Output = T> + Send + 'static, T: Send + 'static,{ TaskHandle(async_std::task::spawn(future))}#[derive(Debug...
Observations/Thoughts 2023-11-22 ~3 min read
blog.shortepic.com
...enum NextPlayerChange { Start, Next, } impl Mutator<SquareMark> for NextPlayerChange { fn mutate(&self, v: &SquareMark) -> SquareMark { use SquareMark::*; match self { Self::Start => X, Self::Next => match v { X => O, O => X, Empty => unreachable!(), }, } } } A square is state, indexable within the board. We set up some defaults so they start Empty, but...
Learn More Rust 2020-10-07 ~8 min read
jaredonline.svbtle.com
...fn update(&mut self, maps: &mut Maps, windows: &mut Windows) { match Game::get_last_keypress() { Some(ks) => { match ks.key { // Because Shift is used for attack keys we don't want to do // anything when it's pushed. We can check for shift when we // process the next keypress SpecialKey...
Blog Posts 2014-11-24 ~19 min read
rust-dd.com
...This allows the router to match incoming request paths and extract the values of dynamic segments at runtime. For instance, a pattern like /users/{id} is turned into a regex that matches /users/123 (or any other value in place of {id}) and captures the id value. By default, route...
Project/Tooling Updates 2025-07-23 ~16 min read
blog.sheerluck.dev
...impl Card for PokerCard { fn value(&self) -> u8 { match self.rank { Rank::Two => 2, Rank::Three => 3, // ... Rank::Ace => 11, } } fn is_face(&self) -> bool { // custom override matches!(self.rank, Rank::Jack | Rank::Queen | Rank::King) } }Trait Bounds Remember the max function that would not compile? Traits fix it. fn...
Rust Walkthroughs 2026-05-13 ~17 min read
deislabs.io
...But most powerfully, we see the use of a match statement when we try to patch the status with the API. This match lets us handle the result and unwrap the data inside, performing a different branch of logic based on the result. Now let’s look at the same...
News & Blog Posts 2020-04-14 ~8 min read
apanatshka.github.io
...Benchmarks not matching either prefix are ignored completely. If benchmark output is sent on stdin, then the second version is used and the third file parameter is not needed. Options: -h, --help Show this help message and exit. --version Show the version. --threshold <n> Show only comparisons with a percentage...
News & Blog Posts 2016-09-06 ~8 min read
immunant.com
...Each va_start and va_copy call must be matched by exactly one va_end call in the same function. For example, this is a very common implementation of the printf function: int printf(const char *fmt, ...) { int res; va_list ap; va_start(ap, fmt); res = vprintf(fmt, ap...
News & Blog Posts 2019-09-17 ~8 min read
lucumr.pocoo.org
...impl Value { fn as_str(&self) -> Option<&str> { match self { Value::String(s) => Some(s), _ => None, } } fn to_string(&self) -> String { match self { Value::String(s) => s.clone(), Value::Number(n) => n.to_string(), } } } So far, so good. What’s important about this particular piece of code we just wrote...
Observations/Thoughts 2022-09-14 ~16 min read
"So long, and thanks for all the turbofish."

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.