Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
crates.io
...writer.push(i).is_some() { // The ringbuffer is full, yield the thread std::thread::yield_now(); } }); // Loop that pulls elements from the ringbuffer loop { match reader.pull() { // We have got an element, do something Some(t) => std::hint::blackbox(t), // The ringbuffer is empty, yield the thread None => std::thread...
Crate v0.2.2 2026-01-27
doc.rust-lang.org
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>
...use std::io; use std::net::TcpListener; let listener = TcpListener::bind("127.0.0.1:7878").unwrap(); listener.set_nonblocking(true).expect("set_nonblocking should succeed"); for stream in listener.incoming() { match stream { Ok(s) => { // do something with the TcpStream handle_connection(s); } Err(ref e) if e.kind() == io...
method std Stable since 1.9.0 Version 1.100.0-nightly
trifectatech.org
...allow unaligned reads in longest_match wasm: SIMD adler32 wasm: SIMD slide_hash wasm: use wider loads/stores in copy_match wasm: SIMD compare256 Decompression implementationspeedup (wall time) baseline-41.1% miniz-oxide-54.9% zlib-ng-25.3% Our optimizations made our implementation over 40% faster; we're now...
Observations/Thoughts 2024-11-20 ~3 min read
noyez.gitlab.io
...Deserializer<'de> { match MacOrU64::deserialize(deserializer)? { MacOrU64::U64(v) => { Ok(v) } MacOrU64::Mac(v) => { mac_addr_as_u64(&v).ok_or(serde::de::Error::custom("Can't parse MAC address")) } } } Note the #[serde(untagged)] attribute which makes the serialized JSON an anonymous object. See the serde documentation for serge’s...
News & Blog Posts 2018-09-04 ~3 min read
docs.rs
...for inner_pair in pair.into_inner() { match inner_pair.as_rule() { Rule::alpha => println!("Letter: {}", inner_pair.as_str()), Rule::digit => println!("Digit: {}", inner_pair.as_str()), _ => unreachable!() }; } } } This produces the following output: Rule: ident Span: Span { start: 0, end: 2 } Text: a1 Letter: a Digit: 1 Rule: ident...
Crate v2.9.7 2026-11-24
arxiv.org
...These guarantees come from a strong ownership-based type system, as well as primitive support for features like closures, pattern matching, etc., that make the code more concise and amenable to reasoning. These unique Rust features also pose a steep learning curve for programmers. This paper presents a tool called...
Research 2023-08-23 ~1 min read
nadrieril.github.io
...let tmp = x.method(); something(&tmp.field); This is exactly what we need for postfix macros: <expr>.macro!() would become (using a match to make the temporary lifetimes work as they should 🤞): match <expr> { place p => macro!(p), } This would have the effect I propose above: any side-effects...
Observations/Thoughts 2025-12-10 ~8 min read
rust.code-maven.com
...For example by using match and handling the Ok and Err cases separately. Inside the prompt function we don't have any explicit error handling. We just added ? at the end of the calls that might fail. This means if either of those calls fail, the prompt function immediately returns...
Miscellaneous 2024-01-03 ~3 min read
docs.rs
...for inner_pair in pair.into_inner() { match inner_pair.as_rule() { Rule::alpha => println!("Letter: {}", inner_pair.as_str()), Rule::digit => println!("Digit: {}", inner_pair.as_str()), _ => unreachable!() }; } } } This produces the following output: Rule: ident Span: Span { start: 0, end: 2 } Text: a1 Letter: a Digit: 1 Rule: ident...
Crate v2.9.7 2026-11-24
docs.rs
...for inner_pair in pair.into_inner() { match inner_pair.as_rule() { Rule::alpha => println!("Letter: {}", inner_pair.as_str()), Rule::digit => println!("Digit: {}", inner_pair.as_str()), _ => unreachable!() }; } } } This produces the following output: Rule: ident Span: Span { start: 0, end: 2 } Text: a1 Letter: a Digit: 1 Rule: ident...
Crate v2.9.7 2026-11-24
doc.rust-lang.org
pub fn into_utf8_lossy(self) -> String
...Vec<u8> = b"Hello \xF0\x90\x80World".into(); let (output, had_invalid_utf8) = match String::from_utf8(input) { Ok(output) => (output, false), Err(error) => { // The bytes were not valid UTF-8, but we can still recover a string. (error.into_utf8_lossy(), true) } }; assert_eq!(String::from("Hello �World"), output...
method alloc Stable since 1.100.0 Version 1.100.0-nightly
docs.rs
...for inner_pair in pair.into_inner() { match inner_pair.as_rule() { Rule::alpha => println!("Letter: {}", inner_pair.as_str()), Rule::digit => println!("Digit: {}", inner_pair.as_str()), _ => unreachable!() }; } } } This produces the following output: Rule: ident Span: Span { start: 0, end: 2 } Text: a1 Letter: a Digit: 1 Rule: ident...
Crate v2.9.7 2026-11-24
docs.rs
...proc_macro::TokenStream) -> proc_macro::TokenStream { match my_macro(tokens.into()) { Ok(tokens) => tokens.into(), Err(diag) => diag.emit_as_expr_tokens().into() } } This does the right thing on nightly or stable. Caveats On stable, due to limitations, any top-level, non-error diagnostics are emitted as errors. This will...
Crate v0.11.0 2026-09-26
doc.rust-lang.org
pub fn splitn<P>(&self, n: usize, pat: P) -> SplitN<'_, P>
...The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character matches. Iterator behavior The returned iterator will not be double ended, because it is not efficient to support. If the pattern allows a reverse search, the rsplitn method can...
method core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn expect(self, msg: &str) -> T
...Instead, prefer to use pattern matching and handle the Err case explicitly, or call unwrap_or, unwrap_or_else, or unwrap_or_default. Panics Panics if the value is an Err, with a panic message including the passed message, and the content of the Err. Examples let x: Result<u32...
method core Stable since 1.4.0 Version 1.100.0-nightly
www.youtube.com
...match on both a to Pi and B tie and just have like an exhaustive list of all the different kinds of questions that we could support um it's just that like kind of think of these as as think of these two matches as like one match just...
Video 2023-08-10
jaredonline.svbtle.com
...fn update(&mut self, maps: &mut Maps, windows: &mut Windows) { match Game::get_last_keypress() { Some(ks) => { match ks.key { // Because Shift is used for attack keys we don't want to do // anything when it's pushed. We can check for shift when we // process the next keypress SpecialKey...
Blog Posts 2014-11-24 ~19 min read
rust-dd.com
...This allows the router to match incoming request paths and extract the values of dynamic segments at runtime. For instance, a pattern like /users/{id} is turned into a regex that matches /users/123 (or any other value in place of {id}) and captures the id value. By default, route...
Project/Tooling Updates 2025-07-23 ~16 min read
blog.sheerluck.dev
...impl Card for PokerCard { fn value(&self) -> u8 { match self.rank { Rank::Two => 2, Rank::Three => 3, // ... Rank::Ace => 11, } } fn is_face(&self) -> bool { // custom override matches!(self.rank, Rank::Jack | Rank::Queen | Rank::King) } }Trait Bounds Remember the max function that would not compile? Traits fix it. fn...
Rust Walkthroughs 2026-05-13 ~17 min read
doc.rust-lang.org
...missing fragment specifier } fn main() { foo!(); } Calling the macro with arguments that would match a rule with a missing specifier (e.g., foo!($name)) was a hard error in all editions. However, simply defining a macro with missing fragment specifiers was not, though we did add a lint in Rust...
The Rust Edition Guide Book 2024-01-01 ~1 min read
"There is essentially no webpage out there that it cannot get through at multiple hundreds of frames-per-second"

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.