fathy.fr
...Google recommending me Chrome, lolfor &key in input {
sequence = match sequence {
Sequence::Char => match key {
0x1b => Sequence::Escape,
0x03 => emit!(Event::Exit),
key => emit!(Event::KeyPress { key }),
},
Sequence::Escape => match key {
b'[' => Sequence::Control,
b'P' => Sequence::DeviceControl(DeviceControl::new()),
0x1b =>
emit!(Event::KeyPress { key: 0x1b }; continue),
key => {
emit!(Event...
Observations/Thoughts
2023-02-01
~12 min read
tvm.apache.org
...The match_any! macro matches the IR node type:
fn describe(expr: &PrimExpr) -> Result<String> {
let text = match_any! {
expr {
Add(ref add) => format!("({} + {})", describe(&add.a)?, describe(&add.b)?),
Mul(ref mul) => format!("({} * {})", describe(&mul.a)?, describe(&mul.b)?),
Var(ref var) => var.name.as_str().to_owned(),
IntImm...
Project/Tooling Updates
2026-11-18
~15 min read
osblog.stephenmarz.com
...That is why with print, we specify the plus '+', so that we match ONE or more. To match ZERO or more, we would use the asterisk '*'.
The second arm has $fmt:expr, which Rust will match if we provide at least one argument. In this case, this is the format...
News & Blog Posts
2019-10-15
~26 min read
kamalmarhubi.com
...Rust has a pattern matching syntax for easily checking which variant an enum value is. If we have a variable fork_result, we can pattern match on it like this:
match fork_result {
ForkResult::Parent { child } => {
// stuff to do if we're in the parent
}
ForkResult::Child => {
// stuff do do...
Notable New Crates & Project Updates
2016-04-25
~9 min read
blog.servo.org
...emilio replaced many ad-hoc checks in the CSS selector matching with more structured and consistent logic.
rlhunt added support for tiling gradients in WebRender.
mrobinson improved the logic for deciding when to clip content.
stshine made text correctly inherit overflow properties from its parent element.
nox shared more code...
News & Blog Posts
2017-04-11
~1 min read
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
dev.to
...HttpRequest) -> impl Responder {
let name = req.match_info().get("name").unwrap();
let resp = format!("hello {}", name);
HttpResponse::Ok().body(resp)
}
Enter fullscreen mode
Exit fullscreen mode
We get the name value from req's match info, then format the return string and return the response.
Now visit http://127.0...
Learn More Rust
2020-08-26
~4 min read
doc.rust-lang.org
pub const fn extend(&self, next: Self) -> Result<(Self, usize), LayoutError>
...In order to match C representation layout repr(C), you should call pad_to_align after extending the layout with all fields. (There is no way to match the default Rust representation layout repr(Rust), as it is unspecified.)
Note that the alignment of the resulting layout will be the...
method
core
Stable since 1.44.0
Version 1.100.0-nightly
doc.rust-lang.org
pub trait IndexMut<Idx>
...Side) -> &Self::Output {
println!("Accessing {index:?}-side of balance immutably");
match index {
Side::Left => &self.left,
Side::Right => &self.right,
}
}
}
impl IndexMut<Side> for Balance {
fn index_mut(&mut self, index: Side) -> &mut Self::Output {
println!("Accessing {index:?}-side of balance mutably");
match index {
Side::Left => &mut self.left,
Side...
trait
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
...Fields of tuples are named using increasing numeric names matching their position in the list of types. The first field is 0. The second field is 1. And so on. The type of each field is the type of the same position in the tuple's list of types.
For...
The Rust Reference
Book
2024-01-01
~1 min read
arXiv
arxiv.org
...These establish tested capacity configurations rather than statistical equivalence or a matched speed advantage over NEST. Published-model workflows extend validation to explicit NMDA dynamics and contextual dendritic plasticity, with up to 2.10-fold acceleration in a matched eight-core NMDA cohort. The results characterize semantic, numerical, and resource...
Computational Engineering
Xinjun Li
2026-10-10
arXiv:2610.23964
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
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
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
rust-lang.github.io
...For instance, could we have pub macro_helper_attr! skip in the standard library, namespaced under core::derives or similar? Could we let macros parse that in a way that matches it in a namespaced fashion, so that:
• If you write #[core::derives::skip], the macro matches it
• If you...
RFC 3698
RFC
2024-09-20
~9 min read
github.com
A cross-platform font loading library font-kit font-kit provides a common interface to the various system font libraries and provides services such as finding fonts on the system, performing nearest-font matching, and rasterizing glyphs. Synopsis let font = SystemSource::new() .select_by_postscript_name("ArialMT") .unwrap() .load() .unwrap...
Crate
v0.14.3
2025-05-26
docs.rs
...Hamming Levenshtein - distance & normalized Optimal string alignment Damerau-Levenshtein - distance & normalized Jaro and Jaro-Winkler Sørensen-Dice The normalized versions return values between 0.0 and 1.0 , where 1.0 means an exact match. There are also generic versions of the functions for non-string inputs. Installation strsim is...
Crate
v0.11.1
2024-04-02