Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
arzg.github.io
...Let’s add an is_trivia method to SyntaxKind to abstract away this behaviour:impl SyntaxKind { pub(crate) fn is_trivia(self) -> bool { matches!(self, Self::Whitespace | Self::Comment) } } Note how the method takes self; this is because it’s more efficient to pass SyntaxKind by value instead of by...
Rust Walkthroughs 2020-12-16 ~3 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.0 2026-08-17
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
github.com
...This matches the behavior of brotli with a custom dictionary as specified in https://datatracker.ietf.org/doc/draft-vandevenne-shared-brotli-format/ What's new in version 4.0.3 Better handling of corrupt brotli files. What's new in version 4.0.2 Better handling of corrupt brotli...
Crate v5.0.3 2026-06-14
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
minikin.me
...TrafficLightEvent) -> TrafficLightState { match (self, event) { // Normal cycle (TrafficLightState::Red, TrafficLightEvent::Timer) => TrafficLightState::Green, (TrafficLightState::Green, TrafficLightEvent::Timer) => TrafficLightState::Yellow, (TrafficLightState::Yellow, TrafficLightEvent::Timer) => TrafficLightState::Red, // Emergency override (_, TrafficLightEvent::Emergency) => TrafficLightState::Red, } } } // Usage fn main() { let mut state = TrafficLightState::Red; println!("Initial state: {:?}", state); // Normal cycle state = state.next(TrafficLightEvent::Timer...
Rust Walkthroughs 2025-03-19 ~22 min read
kerkour.com
...errs::Error) -> HttpResponse { let (status, code) = match &err { Error::AuthenticationRequired => (StatusCode::UNAUTHORIZED, "UNAUTHORIZED"), // 401 Error::PermissionDenied(_) => (StatusCode::FORBIDDEN, "FORBIDDEN"), // 403 Error::NotFound(_) => (StatusCode::NOT_FOUND, "NOT_FOUND"), // 404 _ => (StatusCode::INTERNAL_SERVER_ERROR, "INTERNAL_SERVER_ERROR"), // 500 }; let message = match &self { err @ Error::Internal(_) => { // log the internal error error!("{err}"); err...
Observations/Thoughts 2026-05-20 ~8 min read
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.1 2025-01-03
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
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
doc.rust-lang.org
...Result<i32>) { match result { Ok(n) => println!("The first doubled is {}", n), Err(e) => println!("Error: {}", e), } } fn main() { let numbers = vec!["42", "93", "18"]; let empty = vec![]; let strings = vec!["tofu", "93", "18"]; print(double_first(numbers)); print(double_first(empty)); print(double_first(strings)); } See also: Dynamic dispatch...
Rust by Example Book 2024-01-01 ~1 min read
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
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
gfx-rs.github.io
...team ported WebRender over and got Firefox and Servo running on gfx-hal Our API has settled to be at the lowest level, practically matching Vulkan semantics now, and became completely unsafe. To compensate for this, we have started WebGPU implementation with the idea of it becoming the lowest safe...
News & Blog Posts 2019-01-01 ~1 min read
crates.io
...use srcsrv::{SrcSrvStream, SourceRetrievalMethod}; if let Ok(srcsrv_stream) = pdb.named_stream(b"srcsrv") { let stream = SrcSrvStream::parse(srcsrv_stream.as_slice())?; let url = match stream.source_for_path( r#"C:\build\renderdoc\renderdoc\data\glsl\gl_texsample.h"#, r#"C:\Debugger\Cached Sources"#, )? { SourceRetrievalMethod::Download { url } => Some(url), _ => None...
Crate v0.2.3 2025-03-07
doc.rust-lang.org
pub fn recv(&self, buf: &mut [u8]) -> io::Result<usize>
...Examples use std::net::UdpSocket; let socket = UdpSocket::bind("127.0.0.1:34254").expect("bind should succeed"); socket.connect("127.0.0.1:8080").expect("connect should succeed"); let mut buf = [0; 10]; match socket.recv(&mut buf) { Ok(received) => println!("received {received} bytes {:?}", &buf[..received]), Err(e) => println...
method std Stable since 1.9.0 Version 1.100.0-nightly
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
"< Celti> I just had a recruiter contact me for a Rust job requiring 3+ years of professional experience with it."

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.