Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
zupzup.org
...println!("requests in flight: {}", request_contexts.len()); for ev in &events { match ev.u64 { 100 => { match listener.accept() { Ok((stream, addr)) => { stream.set_nonblocking(true)?; println!("new client: {}", addr); key += 1; add_interest(epoll_fd, stream.as_raw_fd(), listener_read_event(key))?; request_contexts.insert(key, RequestContext::new(stream...
Learn More Rust 2020-10-21 ~15 min read
wiki.cont.run
...Below is its comment.Desugar `<expr>.await` into: ```rust match ::std::future::IntoFuture::into_future(<expr>) { mut pinned => loop { match unsafe { ::std::future::Future::poll( <::std::pin::Pin>::new_unchecked(&mut pinned), ::std::future::get_context(task_context), ) } { ::std::task::Poll::Ready(result) => break result, ::std::task::Poll::Pending => {} } task...
Rust Walkthroughs 2022-01-26 ~14 min read
dev.to
...Environment variables are a good place to store such values and they are fairly easy to change. # main.rs fn main(){ match std::env::var("CLIENT_ID1") { Ok(client_id) => println!("Client ID: {}", client_id), Err(e) => panic!("Couldn't read CLIENT_ID ({})", e), }; match std::env::var("CLIENT_SECRET1...
Learn More Rust 2020-08-11 ~8 min read
blog.sheerluck.dev
...Arc<PathBuf>) { let mut buf = vec![0u8; 8192]; // Read data from the socket let n = match socket.read(&mut buf).await { Ok(0) => return, // client closed immediately Ok(n) => n, Err(_) => return, }; // Parse the request let request = match parse_request(&buf[..n]) { Some(req) => req, None => { let response = Response::new...
Rust Walkthroughs 2026-06-24 ~30 min read
rust-analyzer.github.io
...trait or impl declarations. #8510 move cursor position when using item movers. #8536 (first contribution) slightly improve status messages. #8543 (first contribution) fix "Fill match arms" issue with single-element tuples. #8545 fix primitive shadowing with inner items. #8539 do not propose inherent traits in flyimports and import assists. #8546...
Project/Tooling Updates 2021-04-21 ~1 min read
docs.rs
...fn main() { let client = client("localhost:18443", "user", "pass").expect("failed to create client"); let request = client.build_request("uptime", None); let response = client.send_request(request).expect("send_request failed"); // For other commands this would be a struct matching the returned json. let result: u64 = response.result().expect("response...
Crate v0.20.1 2026-05-27
docs.rs
xml
...use std::fs::File; use std::io::BufReader; use xml::reader::{EventReader, XmlEvent}; fn main() -> std::io::Result<()> { let file = File::open("file.xml")?; let file = BufReader::new(file); // Buffering is important for performance let parser = EventReader::new(file); let mut depth = 0; for e in parser { match e { Ok...
Crate v1.4.0 2026-08-06
arthurtw.github.io
...For example, I think Rust’s match syntax: match key.cmp(&node.key) { Less => return insert(&mut node.left, key, value), Greater => return insert(&mut node.right, key, value), Equal => node.value = value, } looks clearer than Nim’s case statement: case key of "help", "h": echo usageString of "ignore-case...
Blog Posts 2015-01-19 ~17 min read
limpet.net
...fn get_color(layout_box: &LayoutBox, name: &str) -> Option<Color> { match layout_box.box_type { BlockNode(style) | InlineNode(style) => match style.value(name) { Some(Value::ColorValue(color)) => Some(color), _ => None }, AnonymousBlock => None } } The borders are similar, but instead of a single rectangle we draw four—one for each edge of...
Blog Posts 2014-11-10 ~7 min read
tavianator.com
...Bit) -> (Bit, Bit) { match (a, b) { (Zero, Zero) => (Zero, Zero), (Zero, One) => (One, Zero), (One, Zero) => (One, Zero), (One, One) => (Zero, One), } } let (s, c) = half_adder(One, One); println!("One plus One is {:?}, carry the {:?}", s, c); } But we want to do all this at compile-time, not runtime...
Observations/Thoughts 2020-10-21 ~22 min read
rust-analyzer.github.io
...language clients in Restart server. #12850 fix error tooltip message for VSCode status bar item. #12851 don’t add braces to 'if' completion in match guard position. #12832 don’t try to implement default members. #12861 include receiver in struct field autocomplete. #12807 add basic support for completion item details...
Project/Tooling Updates 2022-07-27 ~1 min read
mattrighetti.com
...Form<LoginData> ) -> impl IntoResponse { // dummy function to get a user let user = match db::user::get(&app.pg_pool, &username, &password).await { None => return Redirect::to("/signup").into_response() Some(user) => user }; // get/create a refresh token for the user let refresh_token = match db::refresh_tokens::create(user.id...
Rust Walkthroughs 2025-05-07 ~15 min read
blog.pnkfx.org
...As another example, one can step through the the instructions corresponding to the subcomponents of a match pattern. This way, one might discover which parts matched and which failed to match, and in what order they were evaluated. Here is a concrete example of the latter: 1 2 3 4...
Observations/Thoughts 2022-01-12 ~18 min read
piware.de
...const char **matches = r_grep("ell", "Hello\nworld\ncan you tell?"); for (const char **m = matches; *m; m++) printf("matched line: %s\n", *m); free (matches); However, I am fairly convinced that the strings inside the returned lists get leaked. There is no CString::as_mut_ptr(), I can’t...
Rust Walkthroughs 2021-09-08 ~6 min read
rust-analyzer.github.io
...assist. #8830 implement built-in concat_idents! macro. #8831 apply async semantic token modifier to the async/await keywords. #8840 fix false positive "Missing match arm" when a tuple pattern is shorter than scrutinee type. #8845 add default type parameters on "Generate Default from new function". #8848 attach comments to...
Project/Tooling Updates 2021-05-19 ~1 min read
v5.chriskrycho.com
...let an_example = Example::<String, String, String>::RegularWithGeneric { field: "Hello".into() }; match an_example { Example::RegularWithGeneric { field } => println!("The field is {field}"), _ => println!("Skipping"), } And here’s the same in Swift:3 let an_example = Example<String, String, String>.regularWithGeneric( RegularWithGeneric(field: "Hello") ) switch an_example { case .regularWithGeneric(let wrapped...
Observations/Thoughts 2022-07-13 ~2 min read
aibodh.com
...tinyrt/src/state_machine.rsPlace this inside the match armloop { match this { CartTotal::Start { socks, .. } => { match Pin::new(socks).poll(cx) { Poll::Pending => { println!("[cart] Start: socks price not back yet, waiting"); return Poll::Pending; } Poll::Ready(socks_price) => { println!( "[cart] Start -> GotSocks: socks are ${socks_price}" ); let CartTotal::Start...
Rust Walkthroughs 2026-07-01 ~22 min read
rust-analyzer.github.io
#11107 (first contribution) fix generic type substitution when implementing trait with associated type. #11061 support Move if to guard on if-else chains. #11178 keep block modifiers in Replace match with if let. #11184 pass through mutable parameter references when extracting a function. #11195 pass through reference modifiers when extracting...
Project/Tooling Updates 2022-01-12 ~1 min read
rust.code-maven.com
...path, match Setting status to 404 page not found. with_status_code, with_header, path. Tiny HTTP redirect URL. with_header, Header, HeaderField, Request, Response. Gabor Szabo, the author of the Rust Maven web site maintains several Open source projects in Rust and while he still feels he has tons...
Rust Walkthroughs 2023-12-20 ~1 min read
gitlab.com
...The essential part of security in cookies and localStorage is the idea of an "origin", which is supposed to match roughly with what people intuitively think of as a website, so each "website" gets its own local storage: On the regular web, an origin is an effective Top-Level Domain...
Project/Tooling Updates 2022-01-26 ~2 min read
"I love Rust because it reduces bugs by targeting it’s biggest source… me. Say the same thing about seatbelts in a car. If you don’t plan to have..."

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.