Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
fasterthanli.me
...2 Match arms are patterns match arms are also patterns, just like if let: fn print_number(n: Number) { match n { Number { odd: true, value } => println!("Odd number: {}", value), Number { odd: false, value } => println!("Even number: {}", value), } } // this prints the same as before Exhaustive matches A match has to be...
Learn Standard Rust 2020-09-09 ~31 min read
tech.fpcomplete.com
...Then we pattern match on the Result and return a Pid1Error::ChildPidToBig variant if the conversion fails. You may be wondering why we used this pattern matching instead of ?. With the right From implementation, ? would work just fine. However, if you want to include additional context with your error, like...
News & Blog Posts 2019-12-03 ~22 min read
www.brandons.me
...f32 }, } impl Shape { pub fn perimeter(&self) -> f32 { match self { Shape::Rectangle { width, height } => width * 2.0 + height * 2.0, Shape::Triangle { side } => side * 3.0, Shape::Circle { radius } => radius * 2.0 * std::f32::consts::PI } } pub fn area(&self) -> f32 { match self { Shape::Rectangle { width, height } => width * height, Shape...
Rust Walkthroughs 2022-01-12 ~10 min read
doc.rust-lang.org
pub struct WriterPanicked
...io::Result<()> { panic!() } } let mut stream = BufWriter::new(PanickingWriter); write!(stream, "some data").unwrap(); let result = catch_unwind(AssertUnwindSafe(|| { stream.flush().unwrap() })); assert!(result.is_err()); let (recovered_writer, buffered_data) = stream.into_parts(); assert!(matches!(recovered_writer, PanickingWriter)); assert_eq!(buffered_data.unwrap_err().into_inner(), b"some data");
struct alloc Stable since 1.56.0 Version 1.100.0-nightly
www.thecodedmessage.com
...Endian) -> [u8; 4] { match endianness { Endian::Little | Endian::Native => { ... } Endian::Big => { ... } } } fn from_endian_bytes([u8: 4], endianness: Endian) -> Self { match endianness { Endian::Little | Endian::Native => { ... } Endian::Big => { ... } } } } This would also allow us to implement the concept of “native” byte order a little differently, and create more names for byte...
Observations/Thoughts 2021-11-24 ~19 min read
nitschinger.at
...We can now utilize pattern matching to distinguish between success and error, and if it is successful print out the length of the Vector: 1 2 3 4 match cores { Ok(c) => println!("There are {} cores on this machine.", c.len()), Err(e) => panic!(format!("Could not load cores because...
News & Blog Posts 2016-01-11 ~11 min read
rust-analyzer.github.io
#9123 (first contribution) add Gentoo installation instructions. #9091 fix opening single files. #8717, #9105 update match checking algorithm. #9090 fix type inference with arbitrary self types. #9130 make prefix/suffix parameter inlay hint hiding heuristic is more strict. #9079 don’t take the parent kind of trailing attributes in attribute...
Project/Tooling Updates 2021-06-09 ~1 min read
arXiv arxiv.org
...a callback may publish mid-execution, and multi-input callbacks let developers choose topic-matching policies. Thus preserving DAG semantics relies on conventions; once violated, the model collapses. We propose the Function-as-Subtask (FasS) API, which expresses each subtask as a function whose arguments/return values are the subtask...
Operating Systems Takahiro Ishikawa-Aso, Atsushi Yano, Yutaro Kobayashi et al. 2025-11-11 arXiv:2511.08297
github.com
...use parity_tokio_ipc::Endpoint; use futures::stream::StreamExt; // For testing purposes only - instead, use a path to an actual socket or a pipe let addr = parity_tokio_ipc::dummy_endpoint(); let server = async move { Endpoint::new(addr) .incoming() .expect("Couldn't set up server") .for_each(|conn| async { match...
Crate v0.9.0 2021-07-06
doc.rust-lang.org
pub struct PoisonError<T>
...Examples use std::sync::{Arc, Mutex}; use std::thread; let mutex = Arc::new(Mutex::new(1)); // poison the mutex let c_mutex = Arc::clone(&mutex); let _ = thread::spawn(move || { let mut data = c_mutex.lock().unwrap(); *data = 2; panic!(); }).join(); match mutex.lock() { Ok(_) => unreachable!(), Err(p_err) => { let data...
struct std Stable since 1.0.0 Version 1.100.0-nightly
miren.dev
...Add another variant tomorrow and every match in the codebase that doesn’t cover the new case lights up red at compile time. I can stop writing tests for my own forgetfulness. The ? operator is kind of a revelation to an if err != nil-addled brain like mine. One character...
Observations/Thoughts 2026-04-29 ~5 min read
rust-analyzer.github.io
#4065, #4128 complete unqualified enum variants #4105 code completion for attributes. #3954 we now pre-select completion variant if it matches the expected type. #4006 syntax highlighting for format strings #4069, #4070, #4158 improve documentation. #4098 add setup instructions for YouCompleteMe. #4082 implement rust-analyzer --help. #4090 fix naming of...
News & Blog Posts 2020-05-05 ~1 min read
alexliesenfeld.com
...None, path_matches: None, method: Some("POST"), headers: Some({"Authorization": "token TOKEN", "Content-Type": "application/json"}), header_exists: None, body: None, json_body: None, json_body_includes: None, body_contains: None, body_matches: None, query_param_exists: None, query_param: None, matchers: None }, response: MockServerHttpResponse { status: 201, headers: None, body...
Learn More Rust 2020-09-16 ~11 min read
github.com
...If any of the strings mentioned in `metabuild` do not match one of the build-dependencies, Cargo should produce an error (*before* attempting to generate and compile a `build.rs` script). However, if a string matches a conditional build-dependency, such as one conditional on a feature or target, then...
RFC 2196 RFC 2017-10-31 ~5 min read
crates.io
...new(("sample.tao", 11..48)) .with_message(format!( "The values are outputs of this {} expression", "match".fg(out), )) .with_color(out), ) .with_note(format!( "Outputs of {} expressions must coerce to the same type", "match".fg(out) )) .finish() .print(("sample.tao", Source::from(include_str!("sample.tao")))) .unwrap(); } See examples/ for...
Crate v0.6.0 2025-10-28
aibodh.com
...What’s matches!? The matches! macro checks if a value matches a pattern. matches!(self, CharacterState::Idle) returns true if self is Idle, false otherwise. The | means “or” so matches!(self, CharacterState::Walking | CharacterState::Running) checks if it’s either Walking or Running. Animation Refactoring Now we’ll refactor animation...
Rust Walkthroughs 2025-12-17 ~61 min read
kerkour.com
...handling job({}): {}", job_id, &err); queue.fail_job(job_id).await } }; match res { Ok(_) => {} Err(err) => { println!("run_worker: deleting / failing job: {}", &err); } } }) .await; // sleep not to overload our database tokio::time::sleep(Duration::from_millis(125)).await; } } async fn handle_job(job: Job) -> Result<(), crate::Error> { match job.message...
Rust Walkthroughs 2021-09-08 ~6 min read
docs.rs
...expect("failed to execute process"); } } Simple Fork Example use fork::{fork, Fork, waitpid, WIFEXITED, WEXITSTATUS}; match fork() { Ok(Fork::Parent(child)) => { println!("Parent process, child PID: {}", child); // Wait for child and check exit status match waitpid(child) { Ok(status) => { if WIFEXITED(status) { println!("Child exited with code: {}", WEXITSTATUS(status)); } } Err...
Crate v0.10.0 2026-07-18
xion.io
...Option<String> ) -> Box<Stream<Item=Item, Error=Box<Error>>> { let client = Client::new(handle); Box::new(stream::unfold(after, move |cont_token| { let url = match cont_token { Some(ct) => format!("{}?after={}", URL, ct), None => return None, }; let req = Request::new(Method::Get, url.parse().unwrap()); Some(client.request(req).from...
News & Blog Posts 2018-01-30 ~11 min read
wiredforge.com
...Instead // of having a series of `if`s, we instead use a single `match` statement match v { // if 1, we have a special case, we can return the `Ok` // value with the maximum page size 1 => Ok(PageSize(65_536u32)), // If we find 0 or 2-511, we found and...
Learn Standard Rust 2020-09-16 ~16 min read
"Rust is kind of nice in that it lets you choose between type erasure and monomorphization, or between heap-allocation and stack-allocation, but the do..."

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.