Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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.1 2026-08-25
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
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
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
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
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
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
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
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
arXiv arxiv.org
...Yuga uses a multi-phase analysis approach, starting with a quick pattern-matching algorithm to identify potential buggy components and then conducting a flow and field-sensitive alias analysis to confirm the bugs. We also curate new datasets of lifetime annotation bugs. Yuga successfully detects bugs with good precision on...
Software Engineering Vikram Nitin, Anne Mulhern, Sanjay Arora et al. 2023-10-12 arXiv:2310.08507
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
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
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
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
doc.rust-lang.org
...i32 = match p { Point(x, _) => x }; A unit-like struct is a struct without any fields, defined by leaving off the list of fields entirely. Such a struct implicitly defines a constant of its type with the same name. For example: struct Cookie; let c = [Cookie, Cookie {}, Cookie, Cookie {}]; is...
The Rust Reference Book 2024-01-01 ~1 min read
crates.io
...Print image dimensions use jfifdump::{Reader, SegmentKind, JfifError}; use std::fs::File; use std::io::BufReader; fn main() -> Result<(), JfifError> { let file = File::open("some.jpeg")?; let mut reader = Reader::new(BufReader::new(file))?; loop { match reader.next_segment()?.kind { SegmentKind::Eoi => break, SegmentKind::Frame(frame) => { println!("{}x{}", frame.dimension...
Crate v0.6.0 2024-10-05
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
doc.rust-lang.org
pub struct VaList<'a>
...A VaList can be used across an FFI boundary, and fully matches the platform's va_list in terms of layout and ABI.
struct core Stable since 1.100.0 Version 1.100.0-nightly
"When the answer to your question contains the word "variance" you're probably going to have a bad time."

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.