Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
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
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
hoverbear.org
...std::time::Duration::new(0, 0) } } } fn to_filling(&mut self) { self.state = match self.state { State::Waiting { .. } => State::Filling { rate: 1 }, _ => panic!("Invalid state transition!"), } } } fn main() { let mut state_machine = StateMachine::new(); state_machine.to_filling(); } At first glance it seems okay. But notice some problems? Invalid transition...
Blog Posts 2016-10-18 ~18 min read
hoverbear.org
...std::time::Duration::new(0, 0) } } } fn to_filling(&mut self) { self.state = match self.state { State::Waiting { .. } => State::Filling { rate: 1 }, _ => panic!("Invalid state transition!"), } } } fn main() { let mut state_machine = StateMachine::new(); state_machine.to_filling(); } At first glance it seems okay. But notice some problems? Invalid transition...
Rust Walkthroughs 2025-04-16 ~18 min read
blogsystem5.substack.com
...c_uint, }It is very important to declare the structure as having a C representation so that its memory layout matches what the C compiler produces for the same structure. The kernel expects C semantics in its system call boundary, and we must adhere to that. Additionally, we must ensure...
Rust Walkthroughs 2025-02-19 ~14 min read
www.lpalmieri.com
...web::Data<PgPool>, ) -> HttpResponse { let name = match SubscriberName::parse(form.0.name) { Ok(name) => name, // Return early if the name is invalid, with a 400 Err(_) => return HttpResponse::BadRequest().finish(), }; let new_subscriber = NewSubscriber { email: form.0.email, name, }; match insert_subscriber(&pool, &new_subscriber).await { Ok(_) => HttpResponse::Ok().finish...
Rust Walkthroughs 2020-12-16 ~31 min read
blog.digital-horror.com
...Vec<String> = domains.into_iter().map(|x| x.to_owned()).collect(); match mode { EnrichmentMode::DnsLookup => { // Ignore for now } EnrichmentMode::MxCheck => { // Ignore for now } _ => return Err("enrichment mode not yet implemented"), } Ok(domain_store) }https://github.com/JuxhinDB/twistrs/blob/ddc6facfeae818ea15a523d9a1e9fb04ce3e61fd/src/lib.rs#L601-L632The more astute reader might also...
Learn More Rust 2020-09-09 ~14 min read
blog.arnedebo.com
...bind_slice! can be used to store a borrowed reference of whatever was matched inside into a bucket. Parsing function signatures # We will now move to a slightly larger example, parsing a function signature grammar looking like this: IDENT = 'a'..'z', { 'a'..'z' | '0'..'9' } ; FN_SIGNATURE = 'fn', WHITESPACE, IDENT...
Rust Walkthroughs 2026-06-03 ~9 min read
rustc-dev-guide.rust-lang.org
...fn foo() {} fn bar() {} let a = match my_bool { true => foo, true if other_bool => foo, false => bar, } In this example when type checking the match expression a LUB coercion is performed. This LUB coercion starts out with an initial lub ty of some inference variable ?x due to the...
Guide to Rustc Development Book 2024-01-01 ~12 min read
rustc-dev-guide.rust-lang.org
...Add your variant to the match in rustc_hir/attrs/encode_cross_crate.rs, which should return whether your attribute should be visible in dependent crates. This is usually No for code-gen related attributes, and Yes for analysis related attributes. 4. Create a new struct in rustc_attr_parsing...
Guide to Rustc Development Book 2024-01-01 ~4 min read
huonw.github.io
...1 2 3 trait Foo { fn method(&self, other: &Self); } The types of the two arguments have to match, but this can’t be guaranteed with a trait object: the erased types of two separate &Foo values may not match: 1 2 3 4 5 impl<'a> Foo for Foo...
Blog Posts 2015-01-12 ~9 min read
arxiv.org
...Among its design principles, Rust is aimed at matching C in terms of efficiency, but with increased code security and productivity. This paper presents a comparative study between C and Rust in terms of performance and programming effort, selecting as a case study the simulation of N computational bodies (N...
Research 2021-07-28 ~1 min read
developerlife.com
...fn main() { let args = args().collect::<Vec<String>>(); with(run(args), |it| match it { Ok(()) => exit(0), Err(err) => { eprintln!("{}: {}", style_error("Problem encountered"), err); exit(1); } }); } fn run(args: Vec<String>) -> Result<(), Box<dyn Error>> { match is_stdin_piped() { true => piped_grep(PipedGrepOptionsBuilder::parse(args)?)?, false => grep(GrepOptionsBuilder::parse...
Rust Walkthroughs 2023-05-17 ~6 min read
"I used to think of programs as execution flowing and think about what the CPU is doing. As I moved to rust I started thinking a lot more about memory:..."

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.