xd009642.github.io
...Additionally, the first
inference time is by default quite long to match behaviour observed in
the wild.
There’s also, some likelihood of the inference panicking or failing
without a panic. Interfacing with neural network runtimes often involves an FFI
interface and GPUs. Both of these can cause issues for...
Observations/Thoughts
2024-12-04
~11 min read
deaddabe.fr
...Implementing global aliasing
The need is to be able to match both PascalCase and camelCase, while
keeping the field names in snake_case to cope with established Rust naming
conventions. I first tried to add support for multiple deserialize entries
with the following syntax:
#[serde(rename_all(deserialize = "PascalCase", deserialize...
Observations/Thoughts
2021-01-27
~5 min read
www.afloat.boats
...fn end_player_turn(&mut self) {
self.player_turn = match self.player_turn {
Player::Red => Player::Black,
Player::Black => Player::Red,
}
}
// 2.
pub fn select_col(&mut self, col_idx: u8) -> bool {
// board update logic will go here
self.end_player_turn();
}
}
1. end_player_turnThe end_player_turn function...
Rust Walkthroughs
2025-10-29
~7 min read
uwheel.rs
...if let Some(rewritten) = self.try_rewrite(&plan) {
Ok(Transformed::yes(rewritten))
} else {
Ok(Transformed::no(plan))
}
}
Internally, the rewriter looks for temporal patterns and aggregation functions
that match the stored wheel indices. If there is a match then the target wheel is
queried and the aggregate result gets stored...
Observations/Thoughts
2024-08-21
~4 min read
leshow.github.io
...Rust includes a way to pattern match on enum variants with the match keyword. If you haven’t used a language with robust pattern matching before, it’s really a pleasure to use.
fn plus(a: Option<usize>) -> Option<usize> {
match a {
Some(v) => Some(v + 1),
None => None
}
}
This...
News & Blog Posts
2020-02-18
~20 min read
gfx-rs.github.io
...We were especially interested in finding projects matching the following criteria:
Open-source: allows us to easily debug issues and add or modify existing macOS window and surface support
Already using Vulkan for rendering: allows us to simply load gfx-portability on macOS in place of a Vulkan driver on...
News & Blog Posts
2018-09-04
~3 min read
mhamza.dev
...Now, imagine you want to call this function from JavaScript, passing in an object that matches the structure of Data:
do_work({
key_id: 'key_id',
name: 'name',
});
Unfortunately, this pattern is not currently possible with wasm-bindgen due to the restrictions it imposes. It requires the object passed to...
Project/Tooling Updates
2023-06-21
~3 min read
hugopeters.me
...Plug<B> + Generic1;
}
impl<A> Functor for Option<A> {
fn fmap<B>(&self, f: &dyn Fn(&<Self as Generic1>::I) -> B) -> <Self as Plug<B>>::R {
// Apply the function over the contained value, if there is one
match self {
None => None,
Some(v) => Some(f(v)),
}
}
}
Applicative
This one is...
Rust Walkthroughs
2021-12-08
~5 min read
www.lpalmieri.com
...web::Data<Secret<String>>,
// No longer returning a `Result<HttpResponse, LoginError>`!
) -> HttpResponse {
// [...]
match validate_credentials(credentials, &pool).await {
Ok(user_id) => {
tracing::Span::current()
.record("user_id", &tracing::field::display(&user_id));
HttpResponse::SeeOther()
.insert_header((LOCATION, "/"))
.finish()
}
Err(e) => {
let e = match e {
AuthError::InvalidCredentials(_) => LoginError::AuthError(e.into...
Rust Walkthroughs
2022-01-05
~92 min read
docs.rs
Implementation of Cookie storage and retrieval Provides an implementation for storing and retrieving Cookie s per the path and domain matching rules specified in RFC6265 . Features preserve_order - uses indexmap::IndexMap in lieu of HashMap internally, so cookies are maintained in insertion/creation order public_suffix - Add support for public...
Crate
v0.22.1
2026-02-16
github.com
...fn macros() { // Existing let vec = js_path("$.values[?match(@, $.regex)]", &json)?; // New let q_ast: JpQuery = ::jsonpath_rust::json_query!($.values[?match(@, $.regex)]); } This allows for query strings to be created infallibly at compile time for applications where query strings will be static strings in source code. Limitations Of Compiled...
Crate
v1.0.10
2026-08-24
kyle.space
...u16) -> u8 { match addr { // RAM (mirrored every 0x0800 bytes) 0x0000..=0x07FF => { let ram_offset = (addr as usize) % self.ram.len(); self.ram[ram_offset] } // PRG-ROM (mirrored to fill all 32 KiB) 0x8000..=0xFFFF => { let rom_len = self.rom.prg_rom.len(); let rom_offset = (addr as usize - 0x8000) % rom...
News & Blog Posts
2019-10-22
~29 min read
sjames.github.io
...Sized + ASN1GenType,
{
type Target = T;
fn deref(&self) -> &T {
match self.0 {
AllocatedData::Asn1CodecAllocated(p) => unsafe { &*p as &T },
AllocatedData::RustAllocated(p) => unsafe { &*p as &T },
}
}
}
impl<T> DerefMut for ASNBox<T>
where
T: Sized + ASN1GenType,
{
fn deref_mut(&mut self) -> &mut T {
match self.0 {
AllocatedData::Asn1CodecAllocated(p) => unsafe...
News & Blog Posts
2020-05-12
~18 min read
johns.codes
...match readline {
Ok(line) => {
match SqlQuery::parse_from_raw(line.as_ref()) {
Ok(q) => println!("{q:?}"),
Err(e) => eprintln!("{e:?}"),
}
}
Now we can finally type some stuff and have different things come back.>> select col1 from foo;
(LocatedSpan { offset: 21, line: 1, fragment: "", extra: () }, Select(SelectStatement { tables: ["foo"], fields: ["col1...
Rust Walkthroughs
2023-01-04
~14 min read
arXiv
arxiv.org
...Furthermore, we design different agent systems to match the strengths and weaknesses of different LLMs (o4-mini, GPT-5, Sonnet 4, and Sonnet 4.5). Our study shows that different tools and agent settings are needed to stimulate the system-verification capability of different types of LLMs. The best LLM...
Operating Systems
Chenyuan Yang, Natalie Neamtu, Chris Hawblitzel et al.
2025-12-20
arXiv:2512.18436
rust-lang-nursery.github.io
...The wav feature compiles in only the WAV reader; enable the features matching the formats you need.
Play an audio file
[![rodio-badge]][rodio] [![cat-multimedia-badge]][cat-multimedia]
Playing a notification sound means opening an output device and handing it a decoded source. [rodio][rodio] does both. DeviceSinkBuilder::open...
The Rust Cookbook
Book
2024-01-01
~1 min read
crates.io
...let os = os_type::current_platform(); println!("Type: {:?}", os.os_type); println!("Version: {}", os.version); Or to provide different handling on different operating systems: match os_type::current_platform().os_type { os_type::OSType::OSX => { println!("This is probably an apple laptop!"); } os_type::OSType::Ubuntu => { println!("This is running...
Crate
v2.6.0
2022-09-29
www.ralfj.de
...The same also happens with match statements:
let ptr = std::ptr::null::<i32>();
match *ptr { _ => "happy" } // This is fine!
match *ptr { _val => "not happy" } // This is UB.
The scrutinee of a match expression is a place expression, and if the pattern is _ then a value is never constructed.
However, when...
Observations/Thoughts
2024-08-21
~11 min read
bheisler.github.io
...u64) -> u64 {
match n {
0 => 1,
1 => 1,
n => fibonacci(n-1) + fibonacci(n-2),
}
}
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("fib 20", |b| b.iter(|| fibonacci(20)));
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
Finally, run this benchmark with cargo bench. You should see output...
News & Blog Posts
2018-01-16
~5 min read