Here's a quick question to test your Rust knowledge: which of these lines of code do the same thing?
drop(a);
let _ = b;
c;
Here's a quick question to test your Rust knowledge: which of these lines of code do the same thing?
drop(a);
let _ = b;
c;
Updated 10/2021 to use
nom 7.0
!
This is a demonstration of building a parser in Rust using the
nom
crate. I recently built a parser for
the cddl-cat
crate using nom,
and I found it a surprisingly pleasant experience, much better than my past
experiences with other parser-generators in other languages.
Since I like Rust a lot, and I need an excuse to do more writing about Rust, I thought I'd do another demonstration project. I decided to choose a simple syntax, to keep this a short project. So I'm going to build a parser for JSON.
I've been experimenting with Rust lately, and have just started following Jon Gjengset's videos. In his latest livestream, Jon started a port of the Java ConcurrentHashMap
to Rust. I highly recommend them; it's fun to see how someone with a lot of Rust experience approaches problems.
One of the things that grabbed my attention was his use of crossbeam::epoch
. It's a library that helps you write certain kinds of lock-free concurrent data structures, using an "epoch counter" that allows you to disconnect objects from your main data structure and they will be freed later-- without using any per-object atomic reference counters or other major GC overhead.
How… interesting.
An open source program (ogg123) has been crashing repeatedly on my new laptop. The source code hasn’t changed in years. The stacktrace always points to __lll_unlock_elision()
in glibc, which seems kind of scary. Searches on the web all seem to point back to problems with Haswell CPUs that have broken TSX instructions, and are running out-of-date microcode.
In a busy multithreaded program that opens and closes files a lot, it's surprisingly easy for a minor C mistake to cause data corruption.