boats.gitlab.io
...If its a part of the pattern, then it would be an
irrefutable pattern that would match any future and await it, and could be used
in other positions (like the branches of a match statement). If its part of the
loop, then its just a modified form of the...
News & Blog Posts
2019-04-16
~6 min read
forgestream.idverse.com
...let mut tries_remaining = 3;
loop {
match uploader.upload(chunk.clone()) {
Ok(()) => break,
Err(e @ UploadError::UploadFailed(_)) => {
warn!("Upload failed: {e}");
tries_remaining -= 1;
if tries_remaining == 0 {
return Err(e.to_string());
}
}
Err(e) => {
return Err(e.to_string());
}
}
}
}
Ok(())
}
We created an Uploader trait so that we can...
Observations/Thoughts
2025-08-20
~5 min read
tweedegolf.nl
...LoRaChannel) {
self.radio.set_channel(channel.into())
}
}
Other than that, the set_channel implementation is basically a match over the supported modulation types. the HAL is
used to properly configure the radio for each specific case.Using an enum for modulation types and converting with the From trait works fine...
Rust Walkthroughs
2022-04-20
~9 min read
siciarz.net
...plugin)] extern crate regex_macros;
rusti=> extern crate regex;
rusti=> let re = regex!(r"\b[a-z]{6}:[0-9]{3}\b"); re.is_match("qwerty:123")
true
One great thing about rusti is the .type command which shows the type of an expression. (It's quite similar to :type...
24 Days of Rust continues!
2014-12-22
~2 min read
gill.net.in
...web::Data<Pool>) -> Result<SlimUser, ServiceError> {
use crate::schema::users::dsl::{email, users};
let conn = &pool.get()?;
let mut items = users
.filter(email.eq(&auth_data.email))
.load::<User>(conn)?;
if let Some(user) = items.pop() {
if let Ok(matching) = verify(&user.hash, &auth_data.password) {
if matching {
return Ok...
News & Blog Posts
2019-06-11
~21 min read
redox-os.org
...Also, the addition of a really nice match-case construct to the grammar. @mmstick along with @myfreeweb have been working on Ion’s job control facility on things like adding support for process groups, handling of SIGTERM and SIGTSTP and the addition of bg, wait and jobs builtin commands.
On...
News & Blog Posts
2017-07-11
~5 min read
sam.dev
...When a lane reports a match,
you just need to work out which match is earliest, which is where most of the
complexity in the implementation ended up being.
Beginning the port to NEON
I started out by doing a straight port from the SSE4.2 implementation.
aarch64::uint64x2_t...
Rust Walkthroughs
2026-09-09
~9 min read
getcode.substack.com
...Since they operate element-wise, their shapes must match.In functional programming terms, these operations are like map2 or zip: they apply a binary function elementwise to two tensors.I said the input tensors' shape must match, but I didn't explain what that means. Trivially, two shapes match if...
Rust Walkthroughs
2023-05-03
~39 min read
without.boats
...Rust already uses
this structural equality property when implementing matching. If you derive Eq and PartialEq for
your type and all its members, it should meet the structural equality property needed to be used in
matches and const generics.No complex expressions based on generic types or constsThe other limitation...
News & Blog Posts
2020-07-21
~6 min read
rust-gcc.github.io
...fix ICE with bad match arm type
PR2065
Fix bad handling of generic lifetimes
PR2063
gccrs: Fix bad cast error to bool
PR2062
Remove commented out TuplePatternItemsSingle
PR2058
ast: Refactor rust-ast-lower-type.h to source file
PR2057
Add proper support for `pub(crate)`
PR2056
docker: Do not run...
Project/Tooling Updates
2023-04-12
~9 min read
blog.0xshadow.dev
...If they match exactly, it proves two things: first, that the token was indeed created by someone who knows the secret key (which should only be the server), and second, that the header and payload haven’t been modified since the token was created.
If the signatures match, the server...
Rust Walkthroughs
2025-10-01
~34 min read
dev.to
...In Rust, it's nice that I can make enums be so useful, and moreover, the compiler will throw errors if I have enum values that are never used in match statements. Compare that to Go where missing type values in a switch statement will not throw any kind of...
Observations/Thoughts
2021-01-27
~13 min read
ruffle.rs
...We can confidently say that almost every real world movie will work, but we're constantly finding areas that we would not match Flash, and trying to fix those is difficult.
The most notable fix here comes from @relrelb in #24725,
which finally fixes the long standing issue in Super...
Project/Tooling Updates
2026-11-04
~17 min read
mainmatter.com
...EDeserialize<'a>,
{
let mut de = serde_json::Deserializer::from_str(s);
let error = match T::deserialize(&mut de) {
Ok(v) => {
return Ok(v);
}
Err(e) => e,
};
// [...]
}Nothing new on the happy path—it's the very same thing you're doing today in your own applications with vanilla serde. We...
Observations/Thoughts
2025-02-19
~5 min read
www.possiblerust.com
...Refutability
One restriction of pattern matching in function signatures is that you can only use
irrefutable patterns, meaning patterns that always match.
By contrast, refutable patterns may sometimes fail to match,
perhaps because they specify only a single variant of an enum with multiple variants.
Refutable patterns can be used...
Rust Walkthroughs
2021-02-03
~21 min read
dev.to
...We then pass the index associated with the found entry to our touch_index method, which handles moving the entry to the head of the list:
/// Touches the first entry in the cache that matches the
/// given predicate. Returns `true` on a hit and `false`
/// if no match is found...
Rust Walkthroughs
2021-01-27
~24 min read
dfockler.github.io
...Previous code here
match input_line.trim() {
"exit" => break,
line => {
// !!!!!! Here we changed parse_Num to parse_Expr to match our
// grammar code
println!("{:?}", smellyalater::parse_Expr(&line.to_string()));
}
}
// ... More code under here
Finally we can see what our final src/smellyalater.lalrpop file looks like.
// use std::str...
News & Blog Posts
2016-09-20
~13 min read
www.snoyman.com
...mut set = tokio::task::JoinSet::new();
for url in urls {
set.spawn(download_and_print(&url));
}
while let Some(result) = set.join_next().await {
match result {
Ok(Ok(())) => (),
Ok(Err(e)) => {
set.abort_all();
return Err(e);
}
Err(e) => {
set.abort_all();
return Err(e.into());
}
}
}
Ok(())
}
While the parallelism...
Observations/Thoughts
2023-09-13
~5 min read
guillaumegomez.github.io
...Recent doc contributions
@ollie27 gave primitive types stability attributes in rustdoc.
@radix made a minor improvement to strange grammar in E0525.
@frewsxcv added doc examples & description in std::os::unix::ffi, made minor improvements to docs in std::env structures/functions, added ‘platform-specific’ section to sleep_ms to match...
Other Weeklies from Rust Community
2017-01-24
~2 min read
guillaumegomez.github.io
...Recent doc contributions
@estebank accounted for missing keyword in fn/struct definition, suggested using slice when encountering let x = ""[..];, used suggestions instead of notes ref mismatches, pointed to next token when it is in the expected line, highlighted & when type matches on type mismatch error and shortened output of E0391...
News & Blog Posts
2017-12-05
~2 min read