lupyuen.github.io
...false,
},
14:15,
)
(StackSlot refers to the values in the constants array)
Let’s match the two…
Yep Abstract Syntax Trees can get deeply nested, like this for loop…
(See the complete Abstract Syntax Tree)
But Abstract Syntax Trees are actually perfect for converting Rhai to uLisp.
Lisp is a...
Rust Walkthroughs
2021-09-08
~24 min read
www.sea-ql.org
...let res = Bakery::insert_many(std::iter::empty()) .on_empty_do_nothing() // <- you needed to add this, // otherwise insert empty [] would lead to error .exec(db) .await;assert!(matches!(res, Ok(TryInsertResult::Empty)));
After careful consideration, we made a number of changes in 2.0:
removed APIs (e.g. Insert...
Project/Tooling Updates
2025-09-24
~9 min read
docs.rs
...Support for computing multiple BLAKE2s hashes in parallel, matching the efficiency of BLAKE2sp. See the many module. Example use blake2s_simd::{blake2s, Params}; let expected = "08d6cad88075de8f192db097573d0e829411cd91eb6ec65e8fc16c017edfdb74"; let hash = blake2s(b"foo"); assert_eq!(expected, &hash.to_hex()); let hash = Params::new() .hash_length(16) .key(b"Squeamish Ossifrage") .personal(b...
Crate
v1.0.5
2026-08-20
erickt.github.io
...ip::SocketAddr) -> libc::c_int {
unsafe {
let fd = match libc::socket(libc::AF_INET, libc::SOCK_STREAM, 0) {
-1 => panic!(),
fd => fd,
};
let mut storage = mem::zeroed();
let len = addr_to_sockaddr(addr, &mut storage);
let addrp = &storage as *const _ as *const libc::sockaddr;
match libc::bind(fd, addrp, len...
Blog Posts
2014-11-24
~16 min read
doc.rust-lang.org
pub fn read_line(&self, buf: &mut String) -> io::Result<usize>
...Examples
use std::io;
let mut input = String::new();
match io::stdin().read_line(&mut input) {
Ok(n) => {
println!("{n} bytes read");
println!("{input}");
}
Err(error) => println!("error: {error}"),
}
You can run the example one of two ways:
• Pipe some text to it, e.g., printf foo | path/to/executable...
method
std
Stable since 1.0.0
Version 1.100.0-nightly
blog.paulme.ng
...is_match, find, captures.
A few lines of changes from using Captures to Matches reduce the running time by 2s.
Using dynamic programming to trace the best path in Viterbi decoding
I have speech processing and natural language processing background so I am quite familiar with hidden markov model training...
News & Blog Posts
2019-07-02
~7 min read
www.afloat.boats
...returns a value), we can assign the values to `tile_repr`
// And then write the value to the format "stream"
let tile_repr = match self {
TileType::Empty => "Empty",
TileType::Red => "Player Red",
TileType::Black => "Player Black",
};
write!(f, "{tile_repr}")
}
}
Compiles without a hitch!
And the browser console now logs...
Rust Walkthroughs
2025-08-27
~7 min read
bevyengine.org
...This means 100% of the donations we receive go toward furthering our mission.Donations to Bevy Foundation (including all past donations that occurred this year) are now tax-deductible in the United States.Many employers have donation-matching programs for 501(c)(3)s. It is worth checking to see...
Project/Tooling Updates
2024-09-25
~2 min read
docs.rs
...Result<Package, _> = serde_path_to_error::deserialize(jd); match result { Ok(_) => panic!("expected a type error"), Err(err) => { let path = err.path().to_string(); assert_eq!(path, "dependencies.serde.version"); } } } License Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state...
Crate
v0.1.20
2025-09-15
doc.rust-lang.org
fn from_abstract_name<N>(name: N) -> crate::io::Result<SocketAddr>
...Examples
use std::os::unix::net::{UnixListener, SocketAddr};
#[cfg(target_os = "linux")]
use std::os::linux::net::SocketAddrExt;
#[cfg(target_os = "android")]
use std::os::android::net::SocketAddrExt;
fn main() -> std::io::Result<()> {
let addr = SocketAddr::from_abstract_name(b"hidden")?;
let listener = match UnixListener::bind_addr(&addr) {
Ok(sock...
associated_function
std
Stable since 1.70.0
Version 1.100.0-nightly
freemasen.com
...u8) -> Self {
match v {
1 => Self::Legacy,
2 => Self::WriteAheadLog,
_ => Self::Unknown(v),
}
}
}
Let's just check in on a few things here. First we are deriveing a few more items,
PartialEq and Eq allow for using the == operator with 2 FormatVersions while
the PartialOrd and Ord allow for the...
Rust Walkthroughs
2020-11-18
~14 min read
matthewkmayer.github.io
...if let Some(matches) = matches.subcommand_matches("generate") {
let services_config_path = matches.value_of("services_config").unwrap();
let service_configs = ServiceConfig::load_all(services_config_path)
.expect("Unable to read services configuration file.");
let out_dir = Path::new(matches.value_of("out_dir").unwrap());
commands::generate::generate_services(service...
News & Blog Posts
2017-07-18
~10 min read
xd009642.github.io
Archived: primary link replaced with an archive on 2026-09-12T17:24:52.202Z (UTC; replacement date, not snapshot date)
...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
smallcultfollowing.com
...After that, I will turn to virtual dispatch, impls,
and matching, and show how they interact.The Rust enumI don’t know about you, but when I work with C++, I find that the
first thing that I miss is the Rust enum. Usually what happens is
that I start...
Notable Links
2015-05-18
~5 min read
m-compressors.github.io
...Byte identity with C, SIMD kernels and match finding stay with the tests.
mbrotli and
mzstd now carry machine-checked proofs
in Lean 4 that parts of their code follow RFC 7932 and RFC 8878. They are not
verified codecs yet, and this post is not an announcement that they...
Project/Tooling Updates
2026-11-04
~14 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
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
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
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
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