firedbg.sea-ql.org
...Option<usize> = None; for coin in coins { let next = m - coin; if next < 0 { continue; } count = match (count, min_coins(next, coins)) { (Some(a), Some(b)) => Some(a.min(b + 1)), (Some(a), None) => Some(a), (None, Some(b)) => Some(b + 1), (None, None) => None, } } fire::dbg!("return", count)}The...
Observations/Thoughts
2024-01-31
~4 min read
gfx-rs.github.io
...Not only we are shaping up the HAL API to match Vulkan as close as possible, we are also implementing a Vulkan Portability layer (for linking with C libraries using vulkan.h) in https://github.com/gfx-rs/portability .
Hardware Abstraction Layer
HAL brings a lot of goodies to the...
News & Blog Posts
2018-01-02
~1 min read
without.boats
...Destructors referencing a freed object (use after free)The second bug occurred in this bit of code:let mut state = self.state.as_ref().lock();
if matches!(&*state, State::Completed(_)) {
callback.cancel();
self.deallocate();
} else {
*state = State::Cancelled(callback);
}
This code implements the Completion::cancel method that we called in...
News & Blog Posts
2020-06-16
~4 min read
lwn.net
...The first worked on rest
patterns — patterns in match statements that match the
remainder of a structure. Progress was made, but some patterns remain
unimplemented. The second student worked on moving the lint mechanism away
from GCC's GIMPLE internal
representation, which was unable to support generics, to the gccrs...
Project/Tooling Updates
2025-10-15
~8 min read
ferrous-systems.com
...The process was challenging but matched
what we’ve come to expect from Rust: It enables building correct software at a
much lower cost.”
With this step, we can start rolling out the sales process on Ferrocene. Our
initial availability is limited to a minimum order of 10 license seats...
Project/Tooling Updates
2023-11-08
~1 min read
doc.rust-lang.org
...use std::num::ParseIntError;
fn main() -> Result<(), ParseIntError> {
let number_str = "10";
let number = match number_str.parse::<i32>() {
Ok(number) => number,
Err(e) => return Err(e),
};
println!("{}", number);
Ok(())
}
Rust by Example
Book
2024-01-01
~1 min read
blog.s-m.ac
...Some manual fiddling may be required to get the memory representation to match, but often it’s just a question of shifting by a few bytes one way or another.In the present document we focus on interfacing OCaml [@leroy2013ocaml], Rust [@matsakis2014rust] and C [@ritchie1988c] but more languages support this...
News & Blog Posts
2018-07-24
~13 min read
linebender.org
...This now is defined to match how Vello was interpreting it.
peniko#139: Better document Mix, Compose and Fill.
peniko#144: Deprecate Mix::Clip and make it no longer the default blend mode.
Release v0.4.1 is a backport release for the Linebender Resource Handle migration.
We expect to...
Project/Tooling Updates
2025-10-15
~4 min read
rust-analyzer.github.io
...SyntaxNode) -> SemanticElement {
match node.parent() {
None => module_for_file(node.source_file),
Some(parent) => {
// Recursive call
let parent_semantics = semantics_for_syntax(parent);
for sibling in parent_semantics.children() {
if sibling.source_syntax() == node {
return sibling
}
}
}
}
}
In this formulation, a language server needs to just enough analysis to drill down...
Rust Walkthroughs
2023-12-27
~8 min read
blog.kdubovikov.ml
...chat_id };
match diesel::insert_into(subscribers).values(&subscriber).execute(connection) {
Ok(_) => Ok(subscriber),
Err(_) => Err("Error while saving new subscriber to DB")
}
} else {
Err("The subscriber already exists")
}
}
/// Deletes a subscriber from the database
pub fn unsubscribe(chat_id: i64, connection: &SqliteConnection) -> QueryResult<usize> {
diesel::delete(subscribers.filter(telegram...
Learn More Rust
2020-10-07
~13 min read
alexandrempsantos.com
...bool = match &json[("hasAlphaChannel")] {
serde_json::Value::Bool(b) => *b,
_ => true,
};
let width = match &json["size"]["width"] {
serde_json::Value::Number(n) => n.as_u64().unwrap_or(0),
_ => 0,
};
let height = match &json["size"]["height"] {
serde_json::Value::Number(n) => n.as_u64().unwrap_or(0),
_ => 0,
};
println!("Rust: json...
Rust Walkthroughs
2021-06-02
~10 min read
bluss.github.io
...macro_rules! try_control {
($e:expr) => {
match $e {
x => if x.should_break() {
return x;
}
}
}
}
Blog Posts
2016-10-18
~2 min read
hermitcore.org
...Rust features like iterators, closures, pattern matching, option and result, string formatting, and the ownership system are still usable for a kernel developers.
This was the motivation to evaluate Rust for HermitCore and to develop an experimental version of our libOS in Rust.
Components like the IP stack and uhyve...
News & Blog Posts
2018-06-12
~1 min read
blog.m-ou.se
...In the matching rules of a macro, we can match on things like expressions, identifiers, types, and many other things.
Since ‘valid Python code’ is not an option, we’ll just make our macro accept anything: raw tokens, as many as needed:
macro_rules! python {
($($code:tt)*) => {
...
}
}
(See the resources...
News & Blog Posts
2020-04-21
~14 min read
blog.yoshuawuyts.com
...In order to do so we can match the
type states back to an actual enum, and wrap the type-state variant in it. This
could look something like this (playground):
use futures_lite::prelude::*;
use futures_time::prelude::*;
use futures_time::time::Duration;
use futures_time::stream;
enum TrafficLightWrapper...
Observations/Thoughts
2023-01-04
~14 min read
kitsu.me
...Write>(&self, out: &mut Output<W, Db>) -> serialize::Result {
match *self {
Language::En => out.write_all(b"en")?,
Language::Ru => out.write_all(b"ru")?,
Language::De => out.write_all(b"de")?,
}
Ok(IsNull::No)
}
}
That's a little bit verbose, though pretty straightforward. We just write down bytes to...
News & Blog Posts
2020-06-02
~4 min read
tonyarcieri.com
...Path, buffer : &mut[u8]) {
let mut fd = File::open(&path);
match fd.read(buffer) {
Err(what) => panic!("say {}", what),
Ok(x) => if x < 1 { return; }
}
let len = buffer[0] as usize;
let mut outfd = File::create(&outpath);
match outfd.write_all(&buffer[0 .. len]) {
Err(what) => panic!("say {}", what),
Ok...
Notable Links
2015-03-23
~5 min read
rust-trends.com
...Enums where one variant is substantially larger than the others no longer force every match arm to allocate space for the largest case.The post at dystroy.org includes concrete before-and-after examples from real code, showing both the struct layout change and the corresponding reduction in stack frame...
Newsletters
2026-05-06
~4 min read
siciarz.net
...let docopt = match Docopt::new(USAGE) {
Ok(d) => d,
Err(e) => e.exit(),
};
println!("{}", docopt);
let args: Args = match docopt.decode() {
Ok(args) => args,
Err(e) => e.exit(),
};
Docopt::new() returns a Result<Docopt, Error> value. The errors from docopt have a handy exit() method that prints the error message...
Blog Posts
2014-12-08
~4 min read
steveklabnik.com
...pub fn append(&mut self, other: &mut Self) {
match self.tail {
None => mem::swap(self, other),
Some(mut tail) => {
if let Some(mut other_head) = other.head.take() {
unsafe {
tail.as_mut().next = Some(other_head);
other_head.as_mut().prev = Some(tail);
}
self.tail = other.tail.take();
self.len...
News & Blog Posts
2018-09-18
~5 min read