Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
blog.shortepic.com
...enum NextPlayerChange { Start, Next, } impl Mutator<SquareMark> for NextPlayerChange { fn mutate(&self, v: &SquareMark) -> SquareMark { use SquareMark::*; match self { Self::Start => X, Self::Next => match v { X => O, O => X, Empty => unreachable!(), }, } } } A square is state, indexable within the board. We set up some defaults so they start Empty, but...
Learn More Rust 2020-10-07 ~8 min read
lucumr.pocoo.org
...impl Value { fn as_str(&self) -> Option<&str> { match self { Value::String(s) => Some(s), _ => None, } } fn to_string(&self) -> String { match self { Value::String(s) => s.clone(), Value::Number(n) => n.to_string(), } } } So far, so good. What’s important about this particular piece of code we just wrote...
Observations/Thoughts 2022-09-14 ~16 min read
doc.rust-lang.org
pub fn rsplitn<P>(&self, n: usize, pat: P) -> RSplitN<'_, 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. For splitting from the front, the splitn method can be used...
method core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>
...use std::io::{self, Read}; use std::net::TcpStream; let mut stream = TcpStream::connect("127.0.0.1:7878") .expect("Couldn't connect to the server..."); stream.set_nonblocking(true).expect("set_nonblocking should succeed"); let mut buf = vec![]; loop { match stream.read_to_end(&mut buf) { Ok(_) => break, Err...
method std Stable since 1.9.0 Version 1.100.0-nightly
deislabs.io
...But most powerfully, we see the use of a match statement when we try to patch the status with the API. This match lets us handle the result and unwrap the data inside, performing a different branch of logic based on the result. Now let’s look at the same...
News & Blog Posts 2020-04-14 ~8 min read
apanatshka.github.io
...Benchmarks not matching either prefix are ignored completely. If benchmark output is sent on stdin, then the second version is used and the third file parameter is not needed. Options: -h, --help Show this help message and exit. --version Show the version. --threshold <n> Show only comparisons with a percentage...
News & Blog Posts 2016-09-06 ~8 min read
immunant.com
...Each va_start and va_copy call must be matched by exactly one va_end call in the same function. For example, this is a very common implementation of the printf function: int printf(const char *fmt, ...) { int res; va_list ap; va_start(ap, fmt); res = vprintf(fmt, ap...
News & Blog Posts 2019-09-17 ~8 min read
www.sea-ql.org
...common-async-runtime/async_std_task.rs/// A shim to match tokio's APIpub struct TaskHandle<T>(async_std::task::JoinHandle<T>);pub fn spawn_task<F, T>(future: F) -> TaskHandle<T>where F: Future<Output = T> + Send + 'static, T: Send + 'static,{ TaskHandle(async_std::task::spawn(future))}#[derive(Debug...
Observations/Thoughts 2023-11-22 ~3 min read
thatgeoguy.ca
...Matching enums By default Rust has built in support for deconstruction / pattern-matching enum types (even ones you define!). From our earlier example we can do: let x: PixelFormat; // Assume this is given a value from something match x { PixelFormat::Yuv{ y, u, v } => { println!("Pixel is y: {}, u: {}, v...
Rust Walkthroughs 2021-02-17 ~8 min read
RBR 2017: Ben Striegel
6:10
New Rustacean newrustacean.com
...Actually, so one thing that they mentioned today here at Rust Belt and Rust is in the keynote was the the match ergonomics thing where, like, just like, I'm always like, hey, star over here or, like, you know, ref over here or, like, should it be an ampersand...
Podcast 2017-12-10 6:10
llogiq.github.io
...Gankra asked nicely, so here’s a table with the results: # matches LInt name Comment 167 str_to_string very common elsewhere 102 needless_lifetimes probably old code 71 needless_return quite common elsewhere 32 approx_constant false positives 23 mut_mut may be false positives 19 float_cmp may...
From the Blogosphere 2015-09-07 ~5 min read
www.youtube.com
...take that whatever gets returned from here we're gonna match this has to be a 2-tuple we're gonna match to the first part and then and then we're gonna take the we're going to match to the first part and we'll take that Q...
Video 2019-03-15
rustacean-station.org
...hello@rustacean-station.org Timestamps & referenced resources 03:05 - RPIT lifetime capture rules 08:00 - let chains in if and while if let temporary scope Mara’s post on “super let” Tail expression temporary scope 19:15 - Match ergonomics reservations 24:49 - Unsafe extern blocks 29:15 - Unsafe attributes 32...
Observations/Thoughts 2026-02-04 ~1 min read
crates.io
...Serialize/Deserialize a map while preserving order The aim is to match the standard library HashMap/Set with additional LinkedList style methods and ordered-iterators. Changelog Features serde - Enable serde Serialization and Deserialization Usage use ordered_hash_map::OrderedHashMap; fn main() { let mut map = OrderedHashMap::new(); map.insert("apple", 5...
Crate v0.6.2 2026-11-22
blog.logrocket.com
...Wiremock mocks HTTP responses using request matching and response templating techniques. Request matching checks if the incoming request meets specified conditions. You specify these conditions in the handler. Response templating helps to generate the content of the API response. Here’s an example of mocking with Wiremock: #[cfg(test)] mod...
Rust Walkthroughs 2023-05-24 ~16 min read
doc.rust-lang.org
pub fn debug_set<'b>(&'b mut self) -> DebugSet<'b, 'a>
...format!("{:?}", Foo(vec![10, 11])), "{10, 11}"); In this more complex example, we use format_args! and .debug_set() to build a list of match arms: use std::fmt; struct Arm<'a, L, R>(&'a (L, R)); struct Table<'a, K, V>(&'a [(K, V)], V); impl<'a, L, R...
method core Stable since 1.2.0 Version 1.100.0-nightly
noahkawaguchi.com
...handshake_completing_ack.ack_num, }), } ); use std::assert_matches; assert_matches!(ConnState::new().buggy_establish(handshake_completing_ack), Err(_)); println!("Assertions passed!"); } This was another step in the right direction, but it still had some inconveniences and holes. Callers would match on the TCP state, find it to be TcpState...
Rust Walkthroughs 2026-11-18 ~30 min read
lwn.net
...Currently, it is possible to use pattern matching on a value behind a reference, but not on a value behind a smart pointer — at least without dereferencing the pointer and reborrowing the value behind it. The details exposed by BorrowPlace would be enough to let the compiler safely implement those...
Observations/Thoughts 2026-10-07 ~8 min read
doc.rust-lang.org
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>
...use std::io; use std::net::UdpSocket; let socket = UdpSocket::bind("127.0.0.1:7878").unwrap(); socket.set_nonblocking(true).unwrap(); let mut buf = [0; 10]; let (num_bytes_read, _) = loop { match socket.recv_from(&mut buf) { Ok(n) => break n, Err(ref e) if e.kind() == io::ErrorKind...
method std Stable since 1.9.0 Version 1.100.0-nightly
docs.rs
...enum Fruit { Apple, Bramble(BrambleFruit), Pear, } trait NameOf { fn name_of(&self) -> &str; } impl NameOf for Fruit { fn name_of(&self) -> &str { match self { Fruit::Apple => "apple", Fruit::Bramble(fruit) => fruit.name_of(), Fruit::Pear => "pear", } } } enum BrambleFruit { Blackberry, } impl NameOf for BrambleFruit { fn name_of(&self) -> &str { match self...
Crate v2.1.0 2025-11-07
"The answer is obvious: it's the intersection of trust and frustration."

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.