www.lpalmieri.com
...web::Data<PgPool>,
) -> HttpResponse {
let name = match SubscriberName::parse(form.0.name) {
Ok(name) => name,
Err(_) => return HttpResponse::BadRequest().finish(),
};
let email = match SubscriberEmail::parse(form.0.email) {
Ok(email) => email,
Err(_) => return HttpResponse::BadRequest().finish(),
};
let new_subscriber = NewSubscriber { email, name };
match insert_subscriber(&pool, &new_subscriber).await {
Ok...
Rust Walkthroughs
2021-01-06
~19 min read
oxi-dd65f4.gitlab.io
...As of July 29, 2026, Oxi's frozen 50-document blind sets score 0.828 SSIM with Word and 44/50 page-count matches in Japanese, and 0.825 with 48/50 page-count matches in English. In the published comparison table, English page-count fidelity is the highest among...
Rust Walkthroughs
2026-08-05
~9 min read
animaomnium.github.io
...In the long run, I think that pattern-matching on structured data is a much cleaner and less error-prone route. The issue of deeply-nested pattern-matching can be resolved with a little sugar (e.g. do/with/use notation in Haskell/Koka/Gleam): there’s no reason not...
Observations/Thoughts
2023-04-19
~3 min read
wcgw.dev
...One that is very common in Rust as well, the match statement.
Using match is close to a switch expression in Java and makes use of pattern
matching and destructuring as did the previous example. Here is how this looks like:
let who = match anybody_at_all {
Some(one) => one...
Observations/Thoughts
2023-01-11
~20 min read
system.joekain.com
...I added some debug code to step_over_breakpoint to read back the instruction pointer, using ptrace_util::get_instruction_pointer and added a panic if the two target addresses didn’t match. The panic tripped and reported:
Breakpoint targets don't match:
RIP-1: 555555558ff0
bp: 555555559040
These targets...
News & Blog Posts
2015-09-28
~13 min read
github.com
...However, if you're using Clippy, this
will cause the `match_same_arms` lint to trip! You can silence the lint in this
spot, and provide an explanation that indicates you are doing so deliberately,
by placing this attribute above the `match` line:
```rust
#[allow(match_same_arms, reason = "The...
RFC 2383
RFC
2018-04-02
~10 min read
doc.rust-lang.org
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Option::iter_mut — Returns a mutable iterator over the possibly contained value.
Examples
let mut x = Some(4);
match x.iter_mut().next() {
Some(v) => *v = 42,
None => {},
}
assert_eq!(x, Some(42));
let mut x: Option<u32> = None;
assert_eq!(x.iter_mut().next(), None);
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct SocketAddr
SocketAddr — An address associated with a Unix socket.
Examples
use std::os::unix::net::UnixListener;
let socket = match UnixListener::bind("/tmp/sock") {
Ok(sock) => sock,
Err(e) => {
println!("Couldn't bind: {e:?}");
return
}
};
let addr = socket.local_addr().expect("Couldn't get local address");
struct
std
Stable since 1.10.0
Version 1.100.0-nightly
doc.rust-lang.org
...In “The match Control Flow Construct” section in Chapter 6, we discussed that match arms must all return the same type. So, for example, the following code doesn’t work:
The type of guess in this code would have to be an integer and a string, and Rust requires that...
The Rust Programming Language
Book
2024-02-01
~9 min read
rust-analyzer.github.io
...numeric literals.
#13746 keep comments in "Extract function".
#13774 resolve all inference variables in InferenceResult::assoc_resolutions.
#13777 parse if correctly after a half-open range in match.
#13783, #13784 add parentheses to binding mode hints when they attach to an Or-pattern.
#13766 fix config patching logic for addCallParenthesis.
Project/Tooling Updates
2022-12-21
~1 min read
doc.rust-lang.org
pub fn pair() -> io::Result<(UnixStream, UnixStream)>
UnixStream::pair — Creates an unnamed pair of connected sockets.
Returns two UnixStreams which are connected to each other.
Examples
use std::os::unix::net::UnixStream;
let (sock1, sock2) = match UnixStream::pair() {
Ok((sock1, sock2)) => (sock1, sock2),
Err(e) => {
println!("Couldn't create a pair of sockets: {e:?}");
return
}
};
associated_function
std
Stable since 1.10.0
Version 1.100.0-nightly
pliniker.github.io
...Behold and scorn!
// loop state variables
let mut first_token = true;
let mut after_dot = false;
let mut expect_closeparen = false;
let mut expect_list = true;
loop {
match token {
// Open parenthesis
Some(Token { token: OpenParen, pos }) => {
if expect_closeparen {
return Err(ParseError::new(
pos, String::from("expected close-paren")));
}
if...
News & Blog Posts
2017-03-14
~4 min read
hermanradtke.com
...I found it easiest to use the match keyword when working with these types. There are also combinator functions like map and and_then which allow a set of computations to be chained together. I like to chain combinators together so error logic is separated from the main logic of...
News & Blog Posts
2016-09-20
~11 min read
44:28
Rustacean Station
rustacean-station.org
Episode: What's New in Rust 1.54 and 1.55
...This next one is sort of a small change seemingly, right? So this is open range patterns in match statements. The idea is that if you match on, say, an integer, you can say, I want to match on zero to four, and then I want to match on five...
Podcast
2021-10-25
44:28
pretired.dazwilkin.com
...do-apps-rust 2020-10-08T18:47:56.540626070Z => Matched: GET / (default)
do-apps-rust 2020-10-08T18:47:56.540663254Z => Outcome: Success
do-apps-rust 2020-10-08T18:47:56.543531368Z => Response succeeded.
do-apps-rust 2020-10-08T18:47:56.903673975Z GET /favicon.ico image/avif:
do-apps...
Learn More Rust
2020-10-14
~5 min read
gliderkite.github.io
...use std::env;
let dataset = match env::args().nth(1) {
Some(path) => path,
_ => panic!("The path of the census file must be specified"),
};
As a final note, the underscore _ you see in the above match is an identifier
that can be used to match anything else (i.e. any other...
Learn Simple Rust
2020-10-21
~30 min read
docs.rs
Prefix trie (tree) datastructure (both a set and a map) that provides exact and longest-prefix matches. Prefix-Trie This crate provides prefix-map and prefix-set collections for IP prefixes and other fixed-width prefix types. PrefixMap is backed by a compact TreeBitMap-style trie and supports exact, longest...
Crate
v0.10.2
2026-11-04
docs.rs
...extern crate http_range; use http_range::{HttpRange}; fn main() { let range_str = "bytes=0-8"; let size = 10; match HttpRange::parse(range_str, size) { Ok(rngs) => for r in rngs { println!("Start {}, length {}", r.start, r.length) }, Err(err) => println!("HttpRange parse error: {:?}", err) }; } Used in iron-send-file...
Crate
v0.1.6
2026-10-19
doc.rust-lang.org
pub mod ffi
...This module provides types which will match those defined by C, so that code that interacts with C will refer to the correct types.
module
core
Stable since 1.30.0
Version 1.100.0-nightly
arzg.github.io
Archived: primary link replaced with an archive on 2026-09-12T11:26:21.570Z (UTC; replacement date, not snapshot date)
...Open up expr.rs and scroll down to that todo!() we added earlier:impl Expr {
pub(crate) fn eval(&self) -> Val {
match self {
Self::Number(Number(n)) => Val::Number(*n),
Self::Operation { lhs, rhs, op } => {
let Number(lhs) = lhs;
let Number(rhs) = rhs;
let result = match op {
Op::Add => lhs...
Learn More Rust
2020-10-07
~27 min read