Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
patriksvensson.se
...RECT}; use winapi::um::winuser::{EnumDisplayMonitors, GetMonitorInfoW, MONITORINFOEXW}; fn main() { for monitor in enumerate_monitors() { // Convert the WCHAR[] to a unicode OsString let name = match &monitor.szDevice[..].iter().position(|c| *c == 0) { Some(len) => OsString::from_wide(&monitor.szDevice[0..*len]), None => OsString::from_wide(&monitor.szDevice[0..monitor.szDevice...
News & Blog Posts 2020-06-10 ~2 min read
rust.code-maven.com
...u32 = match cookies.get("counter") { Some(cookie) => match cookie.value().parse() { Ok(val) => val, Err(_) => { eprintln!("Invalid value '{}' for the 'counter' cookie.", cookie.value()); 0 }, }, None => 0, }; let counter = counter + 1; cookies.add(("counter", counter.to_string())); format!("Counter: {}", counter) } #[launch] fn rocket() -> _ { rocket::build().mount("/", routes![index]) } #[cfg(test...
Miscellaneous 2024-01-10 ~8 min read
parsa.wtf
...StateStack, ) -> Termination { match lex.peek(store) { _ => raise_diagnostic(store, lex, emit, stack, DiagnosticKind::E079), } }and now the reveal: > x -b --fn ForOrInOfStatement 1 000000000021e290 <joe::fe::parser_handlers::ForOrInOfStatement>: 21e290: ff c6 inc esi 21e292: 89 f0 mov eax,esi 21e294: 83 e0 3f and eax,0x3f 21e297: 0f b6...
Observations/Thoughts 2026-07-08 ~8 min read
github.com
...This approach is backwards-compatible with the RFC, and is probably a good idea in any case. ## Alternatives ### Multidispatch through tuple types This RFC clarifies trait matching by making trait type parameters inputs to matching, and associated types outputs. A more radical alternative would be to *remove type parameters from...
RFC 195 RFC 2014-08-04 ~36 min read
blog.sheerluck.dev
...Direction) -> bool { matches!( (a, b), (Direction::Up, Direction::Down) | (Direction::Down, Direction::Up) | (Direction::Left, Direction::Right) | (Direction::Right, Direction::Left) ) } matches! is a Rust macro that checks if a value matches a pattern. Snake Movement This is the core logic that runs on each timer tick: fn snake_move...
Rust Walkthroughs 2026-06-03 ~18 min read
www.wilfred.me.uk
...We can use any of +-<>.,[] safely, as long as our brackets are matched.] actual code here! bfc aggressively removes dead code. For example, cells in BF are initialised to zero, so a loop at the beginning of a program is dead: [dead]not-dead We also know that if a...
From the Blogosphere 2015-08-31 ~9 min read
www.ncameron.org
...I would very much like to see quasi-quoting and pattern matching in blessed libraries. These are important tools, the former currently provided by libsyntax. I don't see any reason these must be provided by libmacro, and since quasi-quoting produces AST, they probably can't be (since they...
News & Blog Posts 2015-11-30 ~9 min read
github.com
...Vec<_> = iter::repeat(elem).take(n).collect(); ``` None of these quite match the convenience, power, and performance of: ``` let vec = Vec::from_elem(elem, n) ``` * `#1` is verbose *and* slow, because each `push` requires a capacity check. * `#2` only works for a Copy `elem` and const `n`. * `#3` needs a...
RFC 832 RFC 2015-02-11 ~2 min read
eno.space
...That looks suspiciously like an enum … So let’s rewrite our program and use an enum instead of structs, using match to destructure the enum instead of dynamic dispatch. use std::cell::Cell; enum Sum<'a> { Sum(Box<Sum<'a>>, Box<Sum<'a>>), Constant(i32), Variable(&'a Cell<i32>), } impl...
News & Blog Posts 2018-02-20 ~12 min read
jtjlehi.github.io
...Option<AddStrsError> = None; // we could use `unwrap_or_default` but I think 0 is more clear here let u1 = match s1.parse() { Ok(val) => val, Err(err) => { ret_err = Some(/* map the error */); 0 } }; let u2 = match s2.parse() { Ok(val) => val, Err(err) => { ret_err = Some(/* map the error...
Observations/Thoughts 2026-07-01 ~9 min read
www.fluvio.io
...All this to say, we are now back on track with matching versions in the client/server builds. In addition to these compatibility fixes, 0.9.2 also included some internal fixes to the Streaming Processing Units (SPUs) that should make them more reliable when being deployed in a Kubernetes...
Project/Tooling Updates 2021-08-18 ~2 min read
www.ncameron.org
...There is no Rust type that matches these semantics and has the required layout in memory. Therefore we must use a two step process. First, we use a newtype wrapping an integer. This is used as a field in a data structure, etc., so that when we take a view...
News & Blog Posts 2016-01-18 ~13 min read
matthewkmayer.github.io
...impl Error for CreateQueueError { fn description(&self) -> &str { match *self { CreateQueueError::QueueDeletedRecently(ref cause) => cause, CreateQueueError::QueueNameExists(ref cause) => cause, CreateQueueError::Validation(ref cause) => cause, CreateQueueError::Credentials(ref err) => err.description(), CreateQueueError::HttpDispatch(ref dispatch_error) => dispatch_error.description(), CreateQueueError::Unknown(ref cause) => cause } } } And after: impl Error for CreateQueueError...
News & Blog Posts 2017-06-27 ~5 min read
www.joshmatthews.net
...C header files The next step was writing a header file that matched the public types and functions exposed by my low-level bindings (like an inverse bindgen). This was a straightforward application of writing out function prototypes that match, since all of the types I expose are opaque structs...
News & Blog Posts 2015-10-19 ~5 min read
www.cmyr.net
...this ended up being much harder than I expected it to be, partly because of important differences in the behaviour of the two languages, and partly because of the (self-imposed) obligation to match an existing (idiomatic) python API. Motivation Python is the traditional language of choice for font tools...
Observations/Thoughts 2021-05-19 ~12 min read
github.com
...Some solutions: * `Punctuation(char)` with special rules for pattern matching tokens, * `Punctuation([char])` with a facility for macros to split tokens. Tokenising could match the maximum number of punctuation characters, or use the rules for the current token set. The former would have issues with pattern matching. The latter is...
RFC 1566 RFC 2016-02-15 ~16 min read
dev.to
...openai-oxide, a Rust client that matches the official Python SDK's API surface, with persistent WebSockets, structured outputs, and WASM deployment that aren't available in other Rust clients. Why Not Just Use What Exists? My goal was a Rust client with complete 1:1 parity with the official...
Observations/Thoughts 2026-04-01 ~9 min read
rustc-dev-guide.rust-lang.org
...Requirements • LLVM libraries must be available in your system's library search paths • The LLVM version must match the one used to build your Rust toolchain Troubleshooting steps 1. Verify LLVM is installed and accessible 2. Ensure that library paths are set: export LD_LIBRARY_PATH=/path/to/llvm/lib...
Guide to Rustc Development Book 2024-01-01 ~2 min read
lonami.dev
...i32 = ...; let target = target.to_ne_bytes(); locations.retain(|addr| match process.read_memory(*addr, target.len()) { Ok(memory) => memory == target, Err(_) => false, }); println!("Now have {} locations", locations.len()); We create a vector to store all the locations the first scan finds, and then retain those that match a second...
Miscellaneous 2021-02-17 ~19 min read
guillaumegomez.github.io
...Recent doc contributions @QuietMisdreavus updated formatting of fn signatures and where clauses to match style rfcs in rustdoc. @estebank added an explicit help message for binop type mismatch, added end line display of multiline annotations and used proper span for tuple index parsed as float. @frewsxcv made a couple minor...
News & Blog Posts 2017-04-18 ~2 min read
"You can actually return Iterators without summoning one of the Great Old Ones now, which is pretty cool."

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.