www.propelauth.com
...I find myself missing match in pretty much every other language I go to.However, if I was doing it over, I wouldn’t choose Rust.This advice is primarily for early startups (pre-product/pre-seed/seed). But first, it’s important to ask why we went with Rust...
Observations/Thoughts
2023-02-22
~3 min read
dev.to
...Second, I very much wrote this only for myself, so there isn't much in the way of robustness and error handling is only match statements and some if checks. I think that is something worth fixing.
Third and lastly, I really enjoyed traveling the internet under my own power...
Rust Walkthroughs
2020-11-04
~11 min read
blog.turbo.fish
...let meta = attr.parse_meta()?;
// Pattern matching and error handling…
}
When parsing into our own type, we can avoid all of the pattern matching and
even get some pretty good error handling "for free", but depending on the syntax
you want to parse, the parsing code can take a little...
Rust Walkthroughs
2021-12-29
~11 min read
redox-os.org
...Currently, it attempts to match the Arc theme as closely as possible. The goal is to have all of the
changes required contained where it is easy for other themes to override them.
The login screen has been completely overhauled, as well as the title bars and OrbTK color scheme...
Other Weeklies from Rust Community
2017-02-28
~1 min read
www.fluvio.io
...If version is dev, Kubernetes will expect an image in its local registry with a name matching the pattern infinyon/fluvio-connect-<your connector name>:latest.
Otherwise, the value of version will refer to the image tag to pull from Docker Hub.
e.g.
infinyon/fluvio-connect-<your connector name...
Project/Tooling Updates
2022-02-09
~1 min read
julienblanchard.com
...extern crate regex;
use regex::Regex;
use std::env;
fn main() {
println!("Starting email-checker...");
let re = Regex::new(r"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$").unwrap();
match env::args().nth(1) {
Some(email) => {
if re.is_match(&email) {
println!("{} is a valid email.", email);
} else {
println!("{} is NOT a...
News & Blog Posts
2015-11-23
~3 min read
xd009642.github.io
...while !pending_exprs.is_empty() {
assert!(tries_left > 0);
if index >= pending_exprs.len() {
index = 0;
tries_left -= 1;
}
let (expr_index, expr) = pending_exprs[index];
let lhs = region_ids.get(&expr.lhs);
let rhs = region_ids.get(&expr.rhs);
match (lhs, rhs) {
(Some(lhs), Some(rhs)) => {
pending_exprs.remove...
Observations/Thoughts
2025-05-14
~11 min read
doc.rust-lang.org
...u8) -> bool {
matches!(n, 0...100) // should be `0..=100`
}
Migrations
If your Rust 2015 or 2018 code does not produce any warnings for bare_trait_objects or ellipsis_inclusive_range_patterns and you've not allowed these lints through the use of #![allow()] or some other mechanism, then there...
The Rust Edition Guide
Book
2024-01-01
~1 min read
diziet.dreamwidth.org
...macro_rules!’s pattern language doesn’t have a cooked way to match a data structure, so you have to hand-write a matcher for Rust syntax, in each macro. Writing such a matcher is very hard in the general case, because macro_rules lacks features for matching important parts...
Project/Tooling Updates
2025-02-19
~6 min read
seanchen1991.github.io
...For example, given the following student implementation of an Exercism exercise called two-fer
fn twofer(name: &str) -> String {
match name {
"" => "One for you, one for me.".to_string(),
// use the `format!` macro to return a formatted String
_ => format!("One for {}, one for me.", name),
}
}
would be transformed into the...
Learn More Rust
2020-08-04
~8 min read
mtak-blog.github.io
...The write lock is no longer held and the version number matches the sequence number read at 1. The read is successful.
Other cases where a write lock is aquired after the read has acquired a sequence number are no different than a regular seqlock.
Now for a handwaving explanation...
News & Blog Posts
2019-03-26
~14 min read
quodlibetor.github.io
...new ( ) ; match ( self , other ) { log_syntax ! ( ( & SingleUnitEnum :: One , & SingleUnitEnum :: One ) => { } ) } list } fn assert_equal_field_by_field ( & self , other : & SingleUnitEnum ) { let errs = self . fields_not_equal ( other ) ; if errs . len ( ) > 0 { let mut errmsg = String :: from ( "\n Items are not equal:\n" ) ; for field_err in errs { errmsg . push_str...
News & Blog Posts
2017-01-17
~9 min read
zenoh.io
...This effort has been undertaken for three main reasons:To avoid ambiguity in key expression definition and matching, which before could lead to undefined behaviour.To improve the key expression matcher for better performance.To allow future extensibility to be introduced for more complex matching and behaviours.Briefly, we can...
Project/Tooling Updates
2022-10-19
~8 min read
blog.yoshuawuyts.com
Async Cancellation I— 2021-11-10
tasks and futures
cancelling futures
cancelling tasks
propagating cancellation for futures
propagating cancellation for tasks
patching cancellation propagation
structured concurrency
cancelling a group of tasks
halt-safety
should tasks be detachable?
an async trait which can't be cancelled?
intermediate matching on cancellation?
defer...
Observations/Thoughts
2021-11-17
~24 min read
gigapotential.dev
...Create a VM
let val = unsafe { hv_vm_create(std::ptr::null_mut()) };
match val {
HV_SUCCESS => println!("HV_SUCCESS: The operation completed successfully."),
HV_ERROR => eprintln!("HV_ERROR: The operation was unsuccessful."),
HV_BUSY => eprintln!(
"HV_BUSY: The operation was unsuccessful because the owning resource was busy."
),
HV_BAD...
Rust Walkthroughs
2026-04-22
~10 min read
marcobacis.com
...In the previous post, I implemented the policy update in this way:async fn next(&self, _request: &HttpRequest) -> String {
// Read servers list
let servers = &self.servers;
let max_server_idx = servers.len() - 1;
// Update index
let idx = self
.idx
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |idx| match idx {
x if...
Rust Walkthroughs
2024-06-05
~8 min read
kobzol.github.io
...HashSet<(ObjectName, Ident)>,
}
impl Visitor for CheckNotNullWithoutDefault {
type Break = ();
fn pre_visit_statement(&mut self, statement: &Statement) -> ControlFlow<Self::Break> {
if let Statement::AlterTable {
operations, name, ..
} = statement
{
for op in operations {
match op {
AlterTableOperation::AddColumn { column_def, .. } => {
let has_not_null = column_def
.options
.iter()
.any(|option| option.option == ColumnOption...
Observations/Thoughts
2025-03-26
~6 min read
forgestream.idverse.com
...true,
})
} else {
None
}
}
fn main() {
let user_id = 12;
match find_user_by_id(user_id) {
Some(user) => match user.get_greetings() {
Ok(message) => println!("{}", message),
Err(err) => println!("Error: {}", err),
},
None => println!("User not found."),
}
}
What is happening is that:
The script will find a user by the id...
Observations/Thoughts
2025-08-06
~4 min read
kerkour.com
...Q, user: &User) -> Result<(), Error> {
const QUERY: &str = "INSERT INTO users (id, email)
VALUES ($1, $2)";
sqlx::query(QUERY)
.bind(user.id)
.bind(&user.email)
.execute(db)
.await
.map_err(|err| match err {
sqlx::Error::Database(db_err) if db_err.constraint().is_some() => Error::EmailAlreadyInUse,
err => Error::Unspecified(format...
Rust Walkthroughs
2025-04-02
~6 min read
dev.to
...The parser splits up spaces per word, and provides them in order within the Vec. (Matched quotes are interpreted as a single word in our situation).
main()
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = ApplicationArguments::from_args();
match args.subcommand {
SubCommand::StartServer(opts) => {
println!("Start the server...
Learn More Rust
2020-08-26
~11 min read