rust-lang.github.io
...in match patterns is "inclusive". To avoid confusion, we propose to change the match notation to ... to reflect the distinction. The reason to change the notation, rather than the interpretation, is that the exclusive (respectively inclusive) interpretation is the right default for slicing (respectively matching).
Rationale for the notation
The...
RFC 198
RFC
2014-09-11
~6 min read
joshitech.blogspot.com
...match unsafe { FILTER.as_ref() } {
Some(filter) if !filter.is_match(args.to_string().as_slice()) => return,
_ => {}
}
// Completely remove the local logger from TLS in case anyone attempts to
// frob the slot while we're doing the logging. This will destroy any logger
// set during logging.
let mut logger = LOCAL...
New Projects
2014-12-22
~2 min read
home.expurple.me
...str> {
match db_err {
DbErr::Query(RuntimeErr::SqlxError(Error::Database(database_error))) => {
let constraint_name = database_error.constraint()?;
match database_error.kind() {
ErrorKind::UniqueViolation => humanize_unique_violation(constraint_name),
ErrorKind::ForeignKeyViolation => humanize_fk_violation(database_error.message()),
ErrorKind::CheckViolation => humanize_check_constraint_violation(constraint_name),
_ => None,
}
}
// More match arms here...
Observations/Thoughts
2026-04-15
~2 min read
analog-hors.github.io
...pub fn step(&mut self) {
let opcode = self.take_byte_at_pc();
let aaa = (opcode >> 5) & 0b111;
let bbb = (opcode >> 2) & 0b111;
let cc = opcode & 0b11;
match (aaa, bbb, cc) {
(8.., _, _) | (_, 8.., _) | (_, _, 4..) => unreachable!(),
// match on opcode parts...
}
}
}
The main idea was that I'd be able to use different...
Rust Walkthroughs
2023-04-26
~17 min read
blog.arcjet.com
...In the Result::Ok case it will always return a tuple of strings, where the first string is the remaining text that was not processed, and the second element is the text that was successfully matched by the parser.If it fails to parse then it will return a Result...
Rust Walkthroughs
2024-11-20
~7 min read
iximiuz.com
...libc::c_int) {
println!("[main] What a surprise! Got SIGCHLD!");
match waitpid(Pid::from_raw(-1), None) {
Ok(status) => println!("[main] Child exited with status {:?}", status),
Err(err) => panic!("[main] waitpid() failed: {}", err),
}
println!("[main] Bye Bye!");
exit(0);
}
fn main() {
println!("[main] Hi there! My PID is {}.", getpid());
match...
News & Blog Posts
2019-10-22
~17 min read
adventures.michaelfbryan.com
...To see why this is important, let’s have a look at how many web links there are
in some of the books on my computer.
# The Rust Programming Language (aka "The Book")
$ cd ~/Documents/forks/book
$ rg 'http(s?)://' --stats --glob '*.md' --quiet
421 matches
415 matched lines
330...
News & Blog Posts
2020-05-05
~27 min read
docs.rs
Rust library for approximate string matching Stringmetrics This is a Rust library for approximate string matching that implements simple algorithms such has Hamming distance, Levenshtein distance, Jaccard similarity, and more. Here are some useful quick links: Crate info: https://crates.io/crates/stringmetrics Crate docs: https://docs.rs/stringmetrics/ Python...
Crate
v2.2.2
2022-12-28
lawngno.me
tl;dr
I’ve been comparing crates on crates.io against their upstream repositories in
an effect to detect (and, ultimately, help prevent) supply chain attacks like
the xz backdoor1, where the code published in a package doesn’t match the
code in its repository.
The results of these comparisons...
Observations/Thoughts
2024-06-12
~9 min read
arXiv
arxiv.org
...We also prove a matching lower bound on the number of honest parties required for 2-step termination.
We show that our latency-reduction technique generalizes beyond RBC and applies to other primitives such as asynchronous verifiable secret sharing (AVSS) and asynchronous verifiable information dispersal (AVID), enabling them to complete...
Distributed Computing
Nibesh Shrestha, Qianyu Yu, Aniket Kate et al.
2025-05-05
arXiv:2505.02761
www.sea-ql.org
...non-exhaustive patterns: `&_` not covered | | match table_ref { | ^^^^^^^^^ pattern `&_` not covered |note: `TableRef` defined here | | pub enum TableRef { | ^^^^^^^^^^^^^^^^^ = note: the matched value is of type `&TableRef` = note: `TableRef` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustivelyhelp: ensure that all possible cases are being handled by...
Project/Tooling Updates
2025-09-03
~11 min read
www.slowtec.de
...Vec<_> = key.split(".").collect();
match deep_lookup(&keys, locale) {
Some(res) => res,
None => key.to_string(),
}
}
None => key.to_string(),
}
}
}
fn deep_lookup(keys: &[&str], map: &Map<String, Value>) -> Option<String> {
match &keys {
[] => None,
[last] => map.get(&last.to_string()).and_then(|x| match x {
Value::String(s) => Some(s...
News & Blog Posts
2020-03-03
~10 min read
newrustacean.com
...Paths and matches and SIMD, cargo new changes, and tons of
community-driven learning materials!
Audio
0.5⨉
1⨉
1.25⨉
1.5⨉
1.75⨉
2⨉
§Show Notes
Rust 1.25.0 blog post
RFC #1358 – #[repr(align)]
RFC #2325 – SIMD stabilization
RustConf CFP
Hello Rust
“Functional and Concurrent Programming...
News & Blog Posts
2018-04-03
~1 min read
foon.uk
...Actually, this whole match statement is kind of bulky and I
had planned to get it working with match and then see if Rust had anything
like Scala's Map for Options. Since match is giving us grief, let's just
do that now. Guessing:
pub fn id_at(state...
Blog Posts
2014-11-10
~38 min read
rodolfoghi.github.io
...2
Os casos do match também são padrões como if let:1
2
3
4
5
6
7
fn print_number(n: Number) {
match n {
Number { odd: true, value } => println!("Odd number: {}", value),
Number { odd: false, value } => println!("Even number: {}", value),
}
}
// isso imprime o mesmo de antes
Variáveis são imutáveis...
Learn Standard Rust
2020-08-11
~9 min read
willcrichton.net
...tyrade! {
enum TList {
TNil,
TCons(Type, TList)
}
enum TOption {
TNone,
TSome(Type)
}
// Get the Nth item from the list, where Index is either Z or S<N>
fn Nth<List, Index>() {
match List {
TNil => TNone,
TCons(X, XS) => match Index {
Z => TSome(X),
S(IMinusOne) => Nth(XS, IMinusOne)
}
}
}
}
fn main...
Observations/Thoughts
2021-01-06
~7 min read
rust-lang.github.io
...Inner attributes
Inner attributes can be placed at the top of blocks (and other structure incorporating a block) and apply to that block.
{
#![attr11]
foo()
}
match bar {
#![attr12]
_ => {}
}
// are the same as
#[attr11]
{
foo()
}
#[attr12]
match bar {
_ => {}
}
if
Attributes would be disallowed on if for now, because the interaction with...
RFC 16
RFC
2014-03-20
~4 min read
16:41
New Rustacean
newrustacean.com
Episode: e012: I'm not familiar with that expression
...They aren't match statements, they're match expressions. Thus, you can assign the result of a match expression. So if you were matching on a boolean named bar, you could write let foo equals match bar with the body of the match expression having arms for the true and...
Podcast
2016-03-21
16:41
rustc-dev-guide.rust-lang.org
...Pattern matching
match statements for enums with variants that have fields are lowered to TerminatorKind::SwitchInt, too, but the Operand refers to a Place where the discriminant of the value can be found. This often involves reading the discriminant to a new temporary variable.
Aggregate construction
Aggregate values of any...
Guide to Rustc Development
Book
2024-01-01
~4 min read
doc.rust-lang.org
pub fn current_exe() -> io::Result<crate::path::PathBuf>
...For example, on some Unix platforms, the result is calculated by searching $PATH for an executable matching argv[0], but both the environment and arguments can be be set arbitrarily by the user who invokes the program.
On Linux, if fs.secure_hardlinks is not set, an attacker who can...
function
std
Stable since 1.0.0
Version 1.100.0-nightly