greptime.com
...ident) => {
paste! {
fn [<eval_ $O>](columns: &[VectorRef]) -> Result<VectorRef> {
with_match_primitive_type_id!(columns[0].data_type().logical_type_id(), |$S| {
with_match_primitive_type_id!(columns[1].data_type().logical_type_id(), |$T| {
with_match_primitive_type_id!(columns[2].data_type().logical_type_id(), |$R| {
// clip(a...
Rust Walkthroughs
2025-11-26
~14 min read
dhruv-ahuja.github.io
...Operation) {
let is_empty = queue.len() == 0;
let is_full = queue.len() == self.capacity;
match operation {
Operation::Push { mut is_full_flag } => {
let mut is_empty_flag = self.is_empty.lock().unwrap();
if *is_empty_flag {
*is_empty_flag = false;
println!("set is_empty to false");
self.is_empty_signal...
Rust Walkthroughs
2023-09-06
~9 min read
vitiral.github.io
...Many of the concepts that rust taught such as
expressions returning a value
and pattern matching
were utilized for exactly the same benefit in elm.
A frontend in elm with a backend in rust is a match made in heaven: fun,
performant and safe.
Rust web development
Before I got...
News & Blog Posts
2016-12-13
~4 min read
ohadravid.github.io
...snip ..
}
}
Again, the matching code from dav1d doesn’t initialize this buffer.
Here, switching to MaybeUninit is more difficult, but we can still offer a modest improvement: we’ll only need to do the initialization once if we hoist lr_bak to the top level!pub(crate) fn rav1d_cdef...
Observations/Thoughts
2025-05-28
~14 min read
dev.to
...Using Result for Error Handling
use std::fs::File;
use std::io::ErrorKind;
fn main() {
let greeting_file_result = File::open("hello.txt");
let greeting_file = match greeting_file_result {
Ok(file) => file,
Err(error) => match error.kind() {
ErrorKind::NotFound => match File::create("hello.txt") {
Ok(fc) => fc,
Err(e...
Observations/Thoughts
2026-02-04
~9 min read
andreabergia.com
...Pair<'_, Rule>) -> Block {
rule.into_inner()
.map(|statement| match statement.as_rule() {
Rule::letStatement => parse_statement_let(statement),
Rule::assignmentStatement => parse_statement_assignment(statement),
Rule::returnStatement => parse_statement_return(statement),
Rule::block => BlockElement::NestedBlock(parse_block(statement)),
_ => unreachable!(),
})
.collect()
}
As you can see, it maps pretty closely the grammar’s...
Rust Walkthroughs
2025-02-19
~13 min read
rust-lang.github.io
...The app code looks something like:
// search for "#define FOO nnn"
fn find_c_defines(input: &str) {
let rx = Regex::new(r#"^#define\s+(\w+)\s+([0-9]+)\s*(//(.*))?"#).unwrap();
for captures in rx.captures_iter(input) {
let my_match: Match = captures.get(1).unwrap();
do_some_work(my_match...
RFC 3191
RFC
2021-11-01
~21 min read
fitzgeraldnick.com
...When I benchmark my change against SpiderMonkey, I don’t see any
significant performance improvement from matching the arity.
Next, mraleph noticed that the generic sorting routine was not being
monomorphized, and the comparator functions passed to it were not being inlined.
To mold the JavaScript code into something that...
News & Blog Posts
2018-02-27
~10 min read
ricardomartins.cc
...A better way to convert the enum variants to the correct values is an explicit match:
impl From<PacketType> for u8 {
fn from(original: PacketType) -> u8 {
match original {
PacketType::Data => 0,
PacketType::Fin => 1,
PacketType::State => 2,
PacketType::Reset => 3,
PacketType::Syn => 4,
}
}
}
Pretty straightforward, right? Since the mapping from...
News & Blog Posts
2016-08-09
~15 min read
www.ncameron.org
...macro_rules macros in Rust and syntax-rules macros in Scheme allow for pattern matching of arguments in the macro definition, so different code is substituted for the macro use depending on the arguments.
Depending on how macros are defined will affect how and when macros are lexed and parsed...
News & Blog Posts
2015-10-12
~4 min read
laurmaedje.github.io
...Some pattern include dots to indicate that the
pattern should only match at the start or end of the word.
Now, to find out how to hyphenate a word, we first need a
zero-initialized array of levels with length one less than that of the
word (one entry for...
Observations/Thoughts
2022-07-27
~10 min read
tweedegolf.nl
...We can then configure pin P0_12 as a pullup with sense input like so:let p0_register_block = nrf52840_hal::pac::P0::ptr();
unsafe { &(*p0_register_block).pin_cnf[12] }.write(|w| {
w.dir().input();
w.input().connect();
w.pull().pullup();
w.drive().s0s1();
match sense_when_goes_to...
Rust Walkthroughs
2021-06-09
~6 min read
doc.rust-lang.org
...pointer is directly expected, but also when different function item types with the same signature meet in different arms of the same if or match:
# let want_i32 = false;
# fn foo<T>() { }
// `foo_ptr_1` has function pointer type `fn()` here
let foo_ptr_1: fn() = foo::<i32>;
// ... and so...
The Rust Reference
Book
2024-01-01
~1 min read
rust-lang.github.io
...fn deserialize_from(dest: &mut MyBigEnum) -> Result<(), Error> {
let tag = deserialize_tag()?;
match tag {
A => {
let payload = deserialize_a()?
*dest = A(payload);
}
..
}
Ok(())
}
We must construct the entire payload out-of-place, and then move it into place at the end, even though our API is specifically designed to let...
RFC 2195
RFC
2017-10-30
~13 min read
trifectatech.org
...We believe we can justify this regression though, because with the unsafe-performance-experimental feature flag enabled we match C performance. This feature flag disables 4 bounds checks where data from the input is used to index into a data structure. For most users a ~3% performance regression is likely...
Project/Tooling Updates
2026-06-03
~4 min read
boats.gitlab.io
...This also matches the best default for what we believe will be the primary use
case for alternative registries: internal registries for private organizations.
Rather than requiring each new project to redeclare its dependency on that
registry, each machine can be preconfigured to be able to locate the registry.
Pulling...
News & Blog Posts
2017-10-31
~7 min read
blog.vashishtha.in
...fasterthanlime's "A Rust match made in hell" explores a similar problem related to how match expression scrutinees can extend temporary lifetimes, and how that conflicts with locks.
The section discussing current rules in Niko Matsaki's similarly titled "Temporary Lifetimes"
I'm looking for Summer 2025 internships. Feel free...
Rust Walkthroughs
2023-01-25
~4 min read
wishawa.github.io
...The polling code can then match the returned enum and perform the branching.
Shared mutable borrows#
We also let async blocks share mutable borrows as long as they don't cross any await yieldpoint. This is done by parsing through all the blocks to find shared borrows, and putting all...
Rust Walkthroughs
2023-04-19
~4 min read
www.ncameron.org
...changelog
Atom IDE v0.11 - tag
RFCs
2285 - Update the disambiguation handling in RFC 1946 (intra-rustdoc-links) to match impl concerns - FCP merge
2287 - Benchmarking / cargo bench - FCP close - superseded by 2318
2318 - Post Build Contexts (custom test frameworks)
Meetings
Find all meeting notes here, some highlights:
Cargo build...
News & Blog Posts
2018-02-06
~1 min read
www.nymi.com
...At Nymi, everyone has a passion for making the future better than today and the courage to blaze that path. Our Culture is Recognized for Enabling Employees to Do Their Best WorkHybrid work options to match your styleWe've got a dynamic, open-concept office in the heart of Toronto...
Rust Jobs
2021-08-18
~1 min read