micheletti.io
...Filters now support boolean operators, parentheses, negation, and body/header matching:
method:POST & status:500
host:api.example.test & !path:/health
(status:401 | status:403) & header:authorization
type:json & response_body:error
proto:wss | proto:https
Adjacent terms are an implicit AND, so this works too:
method:POST host:api...
Project/Tooling Updates
2026-08-05
~10 min read
blog.guillaume-gomez.fr
...Request) -> Self::Future {
let path = req.path().to_owned();
::futures::finished(match *req.method() {
Get => {
let values = splitter(&path);
if values.len() != 1 || !self.rw.exists(&values[0]) {
Response::new().with_status(StatusCode::NotFound)
} else if let Some(mut file) = self.rw.get_file(&values[0], false) {
let mut out...
News & Blog Posts
2017-02-28
~10 min read
github.com
...A pattern `Foo { .. }` can
match more things than just the expression `Foo { .. }`, because the pattern
matches any value of the unmentioned fields, but the expression sets them to a
particular value. This means that, with the unstable `inline_const_pat`, the arm
`const { Foo { .. } } =>` matches less than the arm `Foo...
RFC 3681
RFC
2024-08-22
~45 min read
blog.veeso.dev
...S) -> RemoteResult<String> { trace!("Running command: {}", cmd.as_ref()); let mut channel = match session.channel_session() { Ok(ch) => ch, Err(err) => { return Err(RemoteError::new_ex( RemoteErrorType::ProtocolError, format!("Could not open channel: {err}"), )) } }; if let Err(err) = channel.exec(cmd.as_ref()) { return Err(RemoteError::new_ex( RemoteErrorType::ProtocolError...
Observations/Thoughts
2025-01-08
~17 min read
www.lpalmieri.com
...we can use a match statement for control flow - we behave differently depending on the failure scenario we are dealing with.
//! src/routes/subscriptions.rs
use actix_web::http::StatusCode;
// [...]
impl ResponseError for SubscribeError {
fn status_code(&self) -> StatusCode {
match self {
SubscribeError::ValidationError(_) => StatusCode::BAD_REQUEST,
SubscribeError::DatabaseError(_)
| SubscribeError::StoreTokenError...
Rust Walkthroughs
2021-05-19
~43 min read
swatinem.de
...L32, B64
}
impl<'data> ElfHeader<'data> {
pub fn parse(buf: &'data [u8]) -> Option<(Self, &'data [u8])> {
let (e_ident, _rest) = LayoutVerified::<_, ElfIdent>::new_from_prefix(buf)?;
if e_ident.e_mag != *b"\x7fELF" {
return None;
}
match e_ident.e_class {
// 32-bit
1 => {
match e_ident.e_data {
// LE
1...
Rust Walkthroughs
2022-08-10
~11 min read
natkr.com
...waker.clone() };
loop {
match fut.poll(&mut context) {
Poll::Ready(out) => return out,
Poll::Pending => waker.sleep_until_awoken(),
}
}
}
Just to be sure.. let's try it out before continuing. To make sure that
our wakeup works, and that we're actually sleeping when we can:
struct ImmediatelyAwoken(bool);
impl...
Rust Walkthroughs
2025-04-16
~10 min read
usethe.computer
...Event) -> Result<(), Box<dyn Error>> {
self.state = match self.state {
ParserState::Between => {
match ev {
Event::Start(e) if e.local_name() == b"wcproduction" =>
ParserState::ProductionNeedAPI,
_ => ParserState::Between,
}
},
ParserState::ProductionNeedAPI => {
match ev {
Event::Start(e) => match e.local_name() {
b"api_st_cde" => ParserState::ReadAPIState,
b"api_cnty_cde" => ParserState::ReadAPICounty...
Observations/Thoughts
2020-10-28
~17 min read
advancedresearch.github.io
...Reaches minimum value when reaching goal
Smooth gradient when getting closer to the goal
Rule agnostic
Easy to maintain
My first idea of how this heuristic should look like,
was something that used sub-expressions matching with the goal.
I was thinking about how difficult this would be to code...
Project Updates
2020-11-25
~5 min read
llogiq.github.io
...Then
the as_slice simply became a match over the three possible values
returning one of the three const references.
Now my iter just became self.as_slice().iter(), which was faster
than Option’s. Sorry if I start to bore you, but
ACHIEVEMENT UNLOCKED! :-)
For the final (and titular...
From the Blogosphere
2015-07-27
~4 min read
edunham.net
...make sure the claws are right.
Match the center front of the underside with the center of Ferris’s front
(both have a blue + on the pattern). Be sure the pieces have their right
sides together and the claws are sandwiched between them.
Match the points marked with red triangles...
News & Blog Posts
2016-05-23
~5 min read
owengage.com
...return true;
}
match current_state {
None => self.clear_cache(),
Some(si) => {
let cur = self.state(*si).clone();
if !self.clear_cache() {
return false;
}
// The unwrap is OK because we just cleared the cache and
// therefore know that the next state pointer won't exceed
// STATE_MAX.
*si = self.restore_state...
Rust Walkthroughs
2021-09-08
~4 min read
pramode.in
...enum Color {
Red,
Green,
Blue,
}
fn main() {
let c = Color::Green;
match c {
Color::Red => println!("Red"),
Color::Green => println!("Green"),
}
}
The exhaustive nature of the matching process is an important safety net.
Yaron Minsky’s Ocaml for the masses
has a list “destuttering” example which demonstrates the ease with...
News & Blog Posts
2016-09-06
~27 min read
pker.xyz
...The issue handler checks the current TID against our tracked PID
set (we use the lower 32 bits of bpf_get_current_pid_tgid(),
which is the thread ID, matching what the scheduler tracepoints
use). For buffered writes, the kernel's writeback threads
(kworker) are the ones that actually submit...
Project/Tooling Updates
2026-03-04
~13 min read
manishearth.github.io
...cmp_nan, which disallows things like x == NaN
clone_double_ref, which disallows calling .clone() on double-references (&&T), since that’s a straightforward copy and you probably meant to do something like (*x).clone()
match_same_arms, which checks for identical match arm bodies (strong indication of a typo...
News & Blog Posts
2017-01-24
~4 min read
yodalee.me
...u8) -> Result<(), ()>;
}
bus 會 match load/store 的 addr 並選擇正確的記憶體區塊呼叫對應的 load/store,
實作 Device 的裝置再自行計算扣掉起始位址的位址,存取對應的 Vec<u8>。
下面要提到內部包了 VRAM 的 GPU;或是 Timer 接了三條硬體 IO 線,也是一樣實作 Device trait,讓 bus 把存取的呼叫直接 dispatch 給他們。
bus 的 load 實作大概像是這樣:
fn load(&self, addr: u16) -> Result<u8, ()> {
match addr {
CATRIDGE_START...
Observations/Thoughts
2021-06-23
~4 min read
jamesmcm.github.io
...lambda_runtime::Context) -> Result<(), HandlerError> {
// Create clients here once since we will use them in all cases
let s3_client = S3Client::new(Region::EuWest1);
let ses_client = SesClient::new(Region::EuWest1);
let mut rt = tokio::runtime::Runtime::new().unwrap();
match e {
// Match on different events here...
}
}
Deployment
Now we are...
Learn More Rust
2020-09-04
~13 min read
villagesql.com
...use villagesql::{InValue, VdfReturn};
fn rot13_impl(args: &[InValue]) -> VdfReturn {
match args.first() {
Some(InValue::String(s)) => VdfReturn::string(rot13(s)),
Some(InValue::Null) | None => VdfReturn::null(),
_ => VdfReturn::error("rot13: expected a STRING argument"),
}
}
fn rot13(s: &str) -> String {
s.chars()
.map(|c| match c {
'a'..='m' | 'A'..='M' => (c...
Rust Walkthroughs
2026-06-10
~4 min read
nnethercote.github.io
...Compiler
The part of the compiler that does declarative macro matching is quite old.
Much of the code predated Rust 1.0, and it was the kind of code that people do
their best to avoid touching. Time for some Type 2
fun.
I made a lot of PRs to...
Observations/Thoughts
2022-04-13
~13 min read
www.falkordb.com
...AI Assisted Development
The Test Ratchet
Benchmarking against the C engine to make sure we’re still the fastest
We had to match the C engine’s performance. Nobody switches to a slower database because the new one is written in Rust. So we set up benchmarking in CI early...
Project/Tooling Updates
2026-08-05
~1 min read