Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
blog.adamperry.me
...A super nifty part of the stackcollapse scripts for flamegraph is that they let you grep for functions matching a pattern. Protip: all Rust benchmark harnesses invoke a closure like so: bencher.iter(|| do_measured_thing()), easily allowing you to grep for calls to closures to limit the flamegraph to...
News & Blog Posts 2016-07-26 ~20 min read
blog.cloudflare.com
...Env) -> Result<Response> { console_log!( "{} {}, located at: {:?}, within: {}", req.method().to_string(), req.path(), req.cf().coordinates().unwrap_or_default(), req.cf().region().unwrap_or("unknown region".into()) ); if !matches!(req.method(), Method::Post) { return Response::error("Method Not Allowed", 405); } if let Some(file) = req.form_data().await?.get...
Miscellaneous 2021-09-15 ~3 min read
matklad.github.io
...impl<T> Drop for Node<T> { fn drop(&mut self) { loop { match (self.left.take(), self.right.take()) { (None, None) => break, (None, Some(it)) | (Some(it), None) => *self = *it, (Some(left), Some(right)) => { *self = *if left.depth > right.depth { left } else { right } } } } } } This requires maintaining the depths though. Can we...
Observations/Thoughts 2022-11-23 ~4 min read
docs.rs
...Attribute::remove_attributes which takes an &mut Vec<syn::Attribute> and does not only parse the Attribute but also removes those matching. Useful for helper attributes for proc macros, where the helper attributes need to be removed. For parsing a single TokenStream e.g. for parsing the proc macro input...
Crate v0.10.5 2025-10-02
crates.io
...As such, substrings may not always match your intuition: use substring::Substring; assert_eq!("ã".substring(0, 1), "a"); // As opposed to "ã". assert_eq!("ã".substring(1, 2), "\u{0303}") The above example occurs because "ã" is technically made up of two UTF-8 scalar values: the letter "a...
Crate v1.4.5 2021-02-04
docs.rs
Macros to keep types in lockstep with DBus XML definitions zbus-lockstep-macros zbus-lockstep-macros extends zbus-lockstep to match the signature of signal types <T as zvariant::Type>::signature() with a corresponding signature from a DBus XML file more conveniently and succinctly. Motivation In the context of IPC...
Crate v0.7.0 2026-07-27
docs.rs
...1u64 }).unwrap(); ident.normalize().unwrap(); assert!(matches!(ident, Format::TypeName(s) if s.ends_with("Foo<u64>"))); Contributing See the CONTRIBUTING file for how to help out. License This project is available under the terms of either the Apache 2.0 license or the MIT license .
Crate v0.3.0 2026-05-26
ryanskinner.com
...This is what happens when your architecture matches React's design intentions.The Three Missing PiecesLooking back, I realize we'd shipped Rari with some architectural gaps. Not bugs—gaps. We could render React Server Components, but we weren't doing it the right way. Here's what we added...
Project/Tooling Updates 2025-10-29 ~6 min read
rolisz.ro
...use core::fmt; use crate::map::State::{Gray, Red, Blue, Black}; impl fmt::Display for State { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let char = match self { Gray => 'N', Red => 'R', Blue => 'B', Black => 'X' }; write!(f, "{}", char) } } impl fmt::Display for Cell<'_> { fn fmt(&self, f: &mut...
News & Blog Posts 2020-06-16 ~12 min read
chillfish8.ghost.io
...The issue is we can't match relevant documents correctly when the two systems act in different ways.Act 2: Correcting the correction behaviourThe first plan of attack was simple -> just correct the index data itself and search that then return the original text separately. Simple right?Well yes and...
Observations/Thoughts 2021-11-24 ~12 min read
llogiq.github.io
...This means I have to match over all variants that could contain relevant subexpressions to take care of the attributes. An accessor on Expr would have been very helpful here. When I finally thought that I had it figured out, I got an unhelpful error during macro expanson. cargo expand...
News & Blog Posts 2018-11-13 ~4 min read
arXiv arxiv.org
...For other topics (e.g., related topics with language features such as structs, patterns and matchings, and foreign function interface), information is only available on Q&A websites while lacking in the official documentation. Finally, we discuss implications for programming language documenters, particularly how to leverage our approach to prioritize...
Software Engineering Filipe R. Cogo, Xin Xia, Ahmed E. Hassan 2022-02-08 arXiv:2202.04431
lucumr.pocoo.org
...T) -> Value { Value::from(ValueRepr::Object(DynObject::new(Arc::new(value)))) } pub fn downcast_object_ref<T: 'static>(&self) -> Option<&T> { match self.0 { ValueRepr::Object(ref o) => o.downcast_ref(), _ => None, } } pub fn downcast_object<T: 'static>(&self) -> Option<Arc<T>> { match self.0 { ValueRepr::Object(ref o) => o...
Rust Walkthroughs 2024-05-22 ~15 min read
doc.rust-lang.org
...i32, } impl FromStr for Circle { type Err = ParseIntError; fn from_str(s: &str) -> Result<Self, Self::Err> { match s.trim().parse() { Ok(num) => Ok(Circle{ radius: num }), Err(e) => Err(e), } } } fn main() { let radius = " 3 "; let circle: Circle = radius.parse().unwrap(); println!("{:?}", circle); }
Rust by Example Book 2024-01-01 ~1 min read
doc.rust-lang.org
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
...The supplied key may be any borrowed form of the map's key type, but the ordering on the borrowed form must match the ordering on the key type. Examples use std::cmp::Ordering; use std::collections::BTreeMap; #[derive(Clone, Copy, Debug)] struct S { id: u32, name: &'static str, // ignored...
method alloc Stable since 1.40.0 Version 1.100.0-nightly
smallcultfollowing.com
...This operator desugars into a pattern match, but it has the effect of “propagating” the error to the caller of the function. If we look at the copy_data one more time, but imagine that any potential errors were propagated using results, it would look like:fn copy_data(from...
Observations/Thoughts 2022-02-02 ~6 min read
www.thespatula.io
...TcpStream) { let mut ws = WebSocket::new(stream); match ws.connect() { Ok(()) => { println!("WebSocket connection established"); match ws.handle_connection() { Ok(_) => { println!("Connection ended without error"); } Err(e) => { println!("Connection ended with error {:?}", e); } } } Err(e) => { println!("Failed to establish a WebSocket connection: {}", e); } } } What happens here is we create our...
Observations/Thoughts 2024-07-24 ~20 min read
morestina.net
...fn max_line(file_name: &str) -> io::Result<u64> { // ... } This signature gives the callers freedom to decide how to handle the errors indicated by max_line – they can unwrap() the return value to panic in case of error, they can match the error and handle the error variant, or they...
Learn Simple Rust 2020-10-14 ~11 min read
rustc-dev-guide.rust-lang.org
...These can then be mapped to DefIds using TyCtxt::get_diagnostic_item() or checked if they match a DefId using TyCtxt::is_diagnostic_item(). When mapping from a diagnostic item to a DefId, the method will return a Option<DefId>. This can be None if either the symbol isn't...
Guide to Rustc Development Book 2024-01-01 ~4 min read
www.fpcomplete.com
...Couldn't match type 'IO Int' with 'Int' Expected type: [Int] Actual type: [IO Int] Instead, we need to use map's more powerful cousin, traverse (a.k.a. mapM, or "monadic map"). traverse allows us to perform a series of actions, and produce a new list with all of...
Miscellaneous 2020-10-14 ~12 min read
"Your problem is that you’re trying to borrow from the dead."

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.