nbaksalyar.github.io
...match token {
SERVER_TOKEN => {
...
}
}
What does it mean? Well, the match syntax resembles the standard switch construct you can find in “traditional” imperative languages, but it has a lot more power to it. While in e.g. Java switch can match only on numbers, strings, and enums, Rust’s match...
From the Blogosphere
2015-07-13
~35 min read
woodruff.dev
...What to Expect
Real comparisons between Rust and C#
Lessons on ownership, pattern matching, traits, and lifetimes
Daily reflections from a .NET developer mindset
Daily Breakdown
Day 1: Why Rust? A C# Developer’s Journey Begins
Day 2: Installing Rust: From dotnet new to cargo new
Day 3: Hello, World...
Miscellaneous
2025-05-21
~2 min read
github.com
...Making temporary lifetime extension consistent between block expressions and
if/else blocks and match arms. This has already been implemented and approved:
https://github.com/rust-lang/rust/pull/121346
- Dropping temporaries in a match scrutinee *before* the arms are evaluated,
rather than after, to prevent deadlocks.
This has been...
RFC 3606
RFC
2024-04-02
~5 min read
tndl.me
...mismatched types expected `bool`, found `&str`
}
Switch & Match
Switch statements aren't as widely used in JavaScript as if/else, but match statements in Rust are very popular. They aren't exactly the same, and match statements have a lot of powerful uses not available to JavaScript switch statements.
// JavaScript...
Learn Standard Rust
2020-08-26
~4 min read
featherweightmusings.blogspot.co.nz
...Expr) { match e { Add(x, y) => println!("An `Add` variant: {} + {}", x, y), Or(..) => println!("An `Or` variant"), _ => println!("Something else (in this case, a `Lit`)"), }}
Each arm of the match expression matches a variant of `Expr`. All variants must be covered. The last case (`_`) covers all remaining variants, although in...
Community Updates
2014-05-24
~9 min read
github.com
...Checks for `use Enum::*`.
- [match_same_arms](https://rust-lang-nursery.github.io/rust-clippy/master/index.html#match_same_arms): Checks for `match` with identical arm bodies.
- [single_match_else](https://rust-lang-nursery.github.io/rust-clippy/master/index.html#single_match_else): Checks for matches with a...
RFC 2476
RFC
2018-06-14
~30 min read
blog.burntsushi.net
...use bstr::ByteSlice;
fn main() {
let haystack = b"foo bar foo\xFF\xFFfoo quux foo";
let mut matches = vec![];
for start in haystack.find_iter("foo") {
matches.push(start);
}
assert_eq!(matches, [0, 8, 13, 22]);
}
This makes use of the ByteSlice::find_iter method. Unlike the
standard library, bstr...
Project/Tooling Updates
2022-09-14
~40 min read
c410-f3r.github.io
...When Client 2 connects, the previous matching entry is removed and a new chat is established through the insertion of each client ID into the messages collection. A new chat also triggers the awakening of the matching client (Client 1) finally returning the remote ID.
Remember when you heard that...
Rust Walkthroughs
2024-12-04
~11 min read
mercurialsolo.github.io
...The rules engine lets you define declarative policies in .claudectl.toml:[[rules]]
name = "auto-approve-tests"
match_status = ["NeedsInput"]
match_tool = ["Bash"]
match_command = ["cargo test", "npm test"]
match_project = ["api-server"]
action = "approve"
[[rules]]
name = "kill-expensive"
match_cost_above = 10.0
action = "terminate"
All conditions within a rule...
Rust Walkthroughs
2026-04-15
~11 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
rust-lang.github.io
...If you write #[core::derives::skip], the macro matches it
If you use core::derives::skip; and write #[skip], the macro matches it
If you use elsewhere::skip (or no import at all) and write #[skip], the
macro doesn’t match it.
We already have some interaction between macros and...
Compiler
2025-08-20
~9 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
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
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
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
github.com
...Note that slicing is "exclusive" (so `[n..m]` is the interval `n <= x
< m`), while `..` 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...
RFC 198
RFC
2014-09-11
~6 min read
github.com
...Crate name patterns can either be regular crate names or they
can end with a `*` character to match zero or more characters.
For example, a crate name pattern of `lazy_static` will only make the token
apply to the corresponding crate, while `serde*` allows the token to act on
any...
RFC 2947
RFC
2022-11-08
~6 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
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