Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
rust.code-maven.com
...u8 = 254; println!("count: {}", count); for _ in 1..=3 { match count.checked_add(1) { Some(val) => count = val, None => eprintln!("Too much!"), }; println!("count: {}", count); } Same result in release mode. It does not change the value and it returns an Option. In the Some part we get the incremented number...
Miscellaneous 2024-01-10 ~5 min read
buildnectar.com
...When a signal changes, only the exact DOM node updates. 🔒 Compile-Time Safety Rust-inspired borrow checker, type system, and exhaustive pattern matching. Catch bugs before they ship — not in production. 📦 Zero Dependencies No npm, no node_modules, no webpack, no bundler. Your app compiles to a .wasm binary and...
Project/Tooling Updates 2026-07-08 ~2 min read
rust-lang.github.io
...pub struct Foo(SomeType); // in downstream code let Foo(_) = foo; Changing Foo to a normal struct can break code that matches on it -- but there is never any real reason to match on it in that circumstance, since you cannot extract any fields or learn anything of interest about the...
RFC 1105 RFC 2015-05-04 ~23 min read
tokio.rs
...Future<Output = Result<HttpResponse, Error>>, { let listener = TcpListener::bind(self.addr).await?; loop { let mut connection = listener.accept().await?; let request = read_http_request(&mut connection).await?; task::spawn(async move { // Pattern match on the result of the response future match handler(request).await { Ok(response) => write_http_response(connection...
Rust Walkthroughs 2021-05-19 ~22 min read
docs.rs
...In this way it is intended to supercede the existing SliceConcatExt::join method, which only works on slices and can only join with a matching type. §Examples Create a comma separated list: use joinery::Joinable; let result = vec![1, 2, 3, 4].join_with(", ").to_string(); assert_eq!(result, "1...
Crate of the Week 2019-12-03 ~1 min read
kerkour.com
...Where it becomes vicious is that it's totally possible to make Git tags and crates.io versions match while the code is different! There are absolutely no guarantees that the code on crates.io matches the code on GitHub, even if the tags and version numbers match! How to...
Observations/Thoughts 2021-11-17 ~8 min read
www.fpcomplete.com
...fn main() { match std::fs::read_to_string("input.txt") { Ok(s) => println!("{}", s), Err(e) => eprintln!("Unable to read from input.txt: {:?}", e), } } The presence of enums in Rust makes it really easy to ensure you properly handle all failure cases fully. The code above will not panic. If...
Observations/Thoughts 2020-12-02 ~8 min read
rust-lang.github.io
...Drawbacks The intrinsics cannot be used to hint at arms in match expressions. However, given that hints would need to be variants, a simple intrinsic would not be sufficient for those purposes. Alternatives Expose an expect intrinsic. This is what gcc/clang does with __builtin_expect. However there is a...
RFC 1131 RFC 2015-05-20 ~2 min read
sixtyfps.io
...handling :-) Fixes #467 Fixes Fix stretch of children of the GroupBox widget ( ec7d9a ) Apply a vertical stretch in the fluent and ugly style, to match the native style. Fixes #487 Interpreter: fix comparison of enums ( 4aeb9b ) We need to normalize native enum to use dashes Make it possible to disable...
Project/Tooling Updates 2021-09-15 ~2 min read
hegdenu.net
...We match on *self. (remember, Hello is an enum) If we're in the initial state Init then print out hello, {name}!. This is the body of our async function. If we're in the Done state, we panic. (more on this shortly) After our match statement, we set our...
Rust Walkthroughs 2023-05-31 ~8 min read
neikos.me
...post "/:id" => { let mut chain = Chain::new(controllers::user::update); chain.link_before(Authorizer::new( IsOwnerOf::<User>::new() )); chain }, }; let mut mount = Mount::new(); mount.mount("/user", user_router); let server = Iron::new(mount); match server.http("0.0.0.0:3000") { Ok(()) => { /*Listening blocks the thread */ } Err(e) => { println...
Blog Posts 2016-10-11 ~8 min read
ianjk.com
...let path = path.replace("%20", " "); let path = if path.ends_with("/") { Path::new(root_path).join(Path::new(&format!( "{}{}", path.trim_start_matches('/'), "index.html" ))) } else { Path::new(root_path).join(path.trim_matches('/')) }; let extension = path.extension().and_then(OsStr::to_str); // If no extension is specified assume html...
Observations/Thoughts 2020-09-16 ~8 min read
polyfractal.com
...bunch of code to load the file, parse the toml ... // // Once we have a Toml Table, we can call ::decode and // serialize straight into Config let config = Value::Table(toml.unwrap()); match toml::decode(config) { Some(t) => t, None => panic!("Error while deserializing config") } } NetworkHandler Once the config has been...
From the Blogosphere 2015-09-07 ~8 min read
gfx-rs.github.io
...This also matches the goal of the Vulkan Portability Initiative to define a subset of Vulkan which can be efficiently implemented on top of D3D12 and Metal. We started experimenting with a C wrapper that implements “vulkan.h” on a target system. However, getting from a hacked prototype to a...
News & Blog Posts 2018-04-10 ~2 min read
rust-lang.github.io
...R) -> <R as Residual<T>>::TryType { FromResidual::from_residual(r) } match Try::branch(x) { ControlFlow::Continue(v) => v, ControlFlow::Break(r) => break 'try make_try_type(r), } This still uses FromResidual::from_residual to actually create the value, but determines the type to return from the argument via the Residual...
RFC 3721 RFC 2024-02-22 ~19 min read
stevedonovan.github.io
...The match operator matches types explicitly and this is where s.as_str() is still necessary - &s would not work here: let s = "hello".to_string(); ... match s.as_str() { "hello" => {....}, "dolly" => {....}, .... } It’s idiomatic to use string slices in function arguments, knowing that &String will convert to &str. Deref...
News & Blog Posts 2019-12-17 ~16 min read
wolfgirl.dev
...With an owned value or a shared reference, we can just pattern-match to "downcast" from a JSON to a String, or a &JSON to a &String.impl JSON { fn to_str(self) -> Option<String> { match self { Self::String(s) => Some(s), _ => None, } } fn as_str(&self) -> Option<&String> { match...
Rust Walkthroughs 2026-09-30 ~12 min read
www.lpalmieri.com
...Expected range of matching incoming requests: == 1 Number of matched incoming requests: 0' Notice that, on failure, wiremock gives us a detailed breakdown of what happened: we expected an incoming request, we received none. Let's fix that. Green test Our handler looks like this right now: //! src/routes/subscriptions...
Rust Walkthroughs 2021-03-17 ~44 min read
rust-lang.github.io
...If the type ascription expression is in reference context, then we require the ascribed type to exactly match the type of the expression, i.e., neither subtyping nor coercion is allowed. These reference contexts are as follows (where <expr> is a type ascription expression): &[mut] <expr> let ref [mut] x...
RFC 803 RFC 2015-02-03 ~6 min read
cliffle.com
...For instance, here’s a simple one: #[derive(Default)] enum State { #[default] Begin, PinHigh, PinLow, Done, } impl State { fn step(&mut self) -> bool { match self { Self::Begin => { set_pin_high(); *self = Self::PinHigh; false } Self::PinHigh => { set_pin_low(); *self = Self::PinLow; false } Self::PinLow => { tristate_pin(); *self = Self::Done...
Observations/Thoughts 2023-07-12 ~9 min read
"After all, Rust only became as good as it is by going through a rather drastic transformation. At one point it had a GC and Green Threads, famously. T..."

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.