Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
...The should_panic attribute The should_panic attribute causes a test to pass only if the [test function][attributes.testing.test] to which the attribute is applied panics. [!EXAMPLE] #[test] #[should_panic(expected = "values don't match")] fn mytest() { assert_eq!(1, 2, "values don't match"); } The should_panic...
The Rust Reference Book 2024-01-01 ~3 min read
doc.rust-lang.org
pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>>
...Examples use std::process::Command; let mut child = Command::new("ls").spawn()?; match child.try_wait() { Ok(Some(status)) => println!("exited with: {status}"), Ok(None) => { println!("status not ready yet, let's really wait"); let res = child.wait(); println!("result: {res:?}"); } Err(e) => println!("error attempting to wait: {e}"), }
method std Stable since 1.18.0 Version 1.100.0-nightly
doc.rust-lang.org
const UNIX_EPOCH: SystemTime
...Examples use std::time::SystemTime; match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()), Err(_) => panic!("SystemTime before UNIX EPOCH!"), }
associated_constant std Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
...Note that we do not perform coercions when matching traits (except for receivers, see the next page). If there is an impl for some type U and T coerces to U, that does not constitute an implementation for T. For example, the following will not type check, even though it...
The Rustonomicon Book 2024-01-01 ~1 min read
arXiv 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...
Programming Languages Manuel Costanzo, Enzo Rucci, Marcelo Naiouf et al. 2021-07-26 arXiv:2107.11912
www.freecodecamp.org
...f32) -> f32 { match operator { '+' => first_number + second_number, '-' => first_number - second_number, '/' => first_number / second_number, '*' | 'X' | 'x' => first_number * second_number, _ => panic!("Invalid operator used."), } } The match expression works similarly to a switch statement in other languages. The match expression takes a value, and a list of arms. Each...
Rust Walkthroughs 2021-12-01 ~27 min read
qouteall.fun
...In that case the match expression outputs a value. That match has two branches. Each branch also output a value. Because the match target cache.get(&key) indirectly borrows cache mutably. And the second branch Some(v) => {v}'s output indirectly borrow match target. This indirect borrow of cache is...
Rust Walkthroughs 2025-10-29 ~64 min read
crates.io
...use similar::{ChangeTag, TextDiff}; fn main() { let diff = TextDiff::from_lines( "Hello World\nThis is the second line.\nThis is the third.", "Hallo Welt\nThis is the second line.\nThis is life.\nMoar and more", ); for change in diff.iter_all_changes() { let sign = match change.tag() { ChangeTag::Delete => "-", ChangeTag...
Crate v3.2.1 2026-10-24
www.ncameron.org
...We will continue to accept any kind of bracket ((), [], {}) around the pattern, but the kind of bracket must match the use. Whilst new macros are being stabilised, these changes should cause deprecation warnings rather than errors to make adoption of the new macro system easier. Example, old macros: macro_rules...
News & Blog Posts 2015-12-14 ~6 min read
doc.rust-lang.org
pub fn send_to<A>(&self, buf: &[u8], addr: A) -> io::Result<usize>
...This will return an error when the IP version of the local socket does not match that returned from ToSocketAddrs. See Issue #34202 for more details. Examples use std::net::UdpSocket; let socket = UdpSocket::bind("127.0.0.1:34254").expect("bind should succeed"); socket.send_to(&[0; 10], "127...
method std Stable since 1.0.0 Version 1.100.0-nightly
crates.io
...fn eval(e: &Expr) -> i64 { e.collapse_frames(|frame| match frame { ExprFrame::Add(a, b) => a + b, ExprFrame::Sub(a, b) => a - b, ExprFrame::Mul(a, b) => a * b, ExprFrame::LiteralInt(x) => x, }) } let expr = multiply(subtract(literal(1), literal(2)), literal(3)); assert_eq!(eval(&expr), -3); Here's...
Crate v0.5.4 2025-06-09
github.com
...assert_eq!(Adler32::from_buf(&decompressed).finish(), checksum.unwrap()); // Verify that the decompressed data matches the original. assert_eq!(data, &decompressed[..]); For detail on more advanced usage, see the full API documentation . License Licensed under either of Apache License, Version 2.0 ( LICENSE-APACHE or http://www.apache.org/licenses...
Crate v0.2.2 2026-11-01
matklad.github.io
...Option<Walrus>) { let walrus = match walrus { Some(it) => it, None => return, }; ... } As in the example above, this often comes up with preconditions: a function might check precondition inside and “do nothing” if it doesn’t hold, or it could push the task of precondition checking to its caller, and enforce...
Observations/Thoughts 2023-11-22 ~3 min read
doc.rust-lang.org
pub enum Prefix<'a>
...Examples use std::path::{Component, Path, Prefix}; use std::path::Prefix::*; use std::ffi::OsStr; fn get_path_prefix(s: &str) -> Prefix<'_> { let path = Path::new(s); match path.components().next().unwrap() { Component::Prefix(prefix_component) => prefix_component.kind(), _ => panic!(), } } assert_eq!(Verbatim(OsStr::new("pictures")), get_path_prefix(r...
enum std Stable since 1.0.0 Version 1.100.0-nightly
rust-lang.github.io
...Make extern crate match fuzzily Alternatively, we can have the compiler consider hyphens and underscores as equal while looking up a crate. In other words, the crate flim-flam would match both extern crate flim_flam and extern crate "flim-flam" as flim_flam. This involves much more magic than...
RFC 940 RFC 2015-03-05 ~3 min read
arXiv arxiv.org
...A transition is enabled only when type matching and interface obligations both hold and the required resource states are available. Based on the bisimulation theory, we prove that the enabling and firing rules of PCPN are consistent with the compile-time check of these three constraints. We develop an automatic...
Software Engineering Kaiwen Zhang, Guanjun Liu 2026-04-02 arXiv:2604.02399
arXiv arxiv.org
...On the NVIDIA B200 GPU, cuTile Rust achieves 7 TB/s for element-wise operations and 2 PFlop/s for GEMM (96% of cuBLAS), matching cuTile Python within measurement noise. Grout, a cuTile-Rust-based inference engine, exercises cuTile Rust across an end-to-end Qwen3 inference path. In batch...
Programming Languages Melih Elibol, Jared Roesch, Isaac Gelado et al. 2026-06-14 arXiv:2606.15991
dcuddeback.github.io
...extern crate libudev; fn main() { let context = libudev::Context::new().unwrap(); let mut enumerator = libudev::Enumerator::new(&context).unwrap(); enumerator.match_subsystem("tty").unwrap(); for device in enumerator.scan_devices().unwrap() { println!("found device: {:?}", device.syspath()); } } License Copyright © 2015 David Cuddeback Distributed under the MIT License .
Crate v0.3.0 2021-01-17
www.fluvio.io
...This meant that we needed a separate filter per pattern we wanted to match on. However we've added the capability to pass in user inputs at the time of execution. So we can have a single filter covering multiple patterns based on how we use it. This is an...
Project/Tooling Updates 2021-11-03 ~3 min read
rustc-dev-guide.rust-lang.org
...A node is considered to match a filter if all of those strings appear in its label. So, for example: RUST_DEP_GRAPH_FILTER='-> TypeckTables' would select the predecessors of all TypeckTables nodes. Usually though you want the TypeckTables node for some particular fn, so you might write: RUST_DEP...
Guide to Rustc Development Book 2024-01-01 ~3 min read
"<kmc\> Rust std library has a type called Cow <alixir\> seems useful <alixir\> to avoid Mooving data unnecessarily"
— [Submit your quotes for next week][submit]!

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.