Being a part of the technology community means developing relationships with wizards thousands of kilometres away. It is a simultaneously lonely and connected feeling.

And then, sometimes, all those threads converge in a single point. One becomes able to look in the eye and smile at all those distant mentors, friends and co-collaborators we shared our work with.

That place, for me, today, is RustConf.

I'm looking forward to tomorrow, another full day of learning and sharing. But for the souls who couldn't make it, here is a diary of the day's experiences - and, for those who did make it, well, a different perspective from their own may be appreciated.

Artificial Incompetence

No, to Hell with "chronological order". This is the penultimate talk I listened to today, about the crate cargo-mutants. I'm bringing it up first because I thought the technology was really cool. Plus, it's something readers of the blog can probably play with right now!

This is not a new concept. However, this Rust-specific implementation matches harmoniously with the language's robustness.

Running cargo mutants in your command line will immediately summon an imaginary software developer intern who will proceed to butcher your testing suite code and implement horrible bugs. This is expressed by:

  • Replacing operators (such as && with ||, or += with -=)
  • Replacing functions with a return type with an arbitrary variation of that return type.

Example of the latter: get_cute_otters() returns a -> Option<usize>. cargo-mutants will transform calls of this function like this:

- assert_eq!(get_cute_otters(), Some(3));
+ assert_eq!(Some(0), Some(3));
+ // or
+ assert_eq!(None, Some(3));

cargo-mutants will then raise a warning for any mutation attempt that did not break tests and cause them to fail. After all, if randomly slamming the keyboard on your test suite is labeled as "perfectly fine" by cargo test, it may be time for some detective work.

In my opinion, this does not seem like cargo clippy where one should aim for absolutely 0 warnings. After all, replacing make_sure_this_returns_true_otherwise_existence_will_be_erased() with true should keep the tests passing. Rather, it's an invitation to review potential sources of error and look at your implementation with fresh eyes.

Remember, the developer who wrote the code is usually the one also writing the tests. That means absolutely nothing is stopping them from having a blind spot and making the same mistake twice.

Between Sky And Sea

There is this notion in the technology world that user interface designers are the tip of the iceberg - and the part of development the uninitiated are most acquainted with - while the Atlantean civilization beyond mortal understanding at the bottom of the sea (also known as "kernel and compiler developers") stays hidden from view.

There is another world, one which seems to grow year after year. The network architects, the database connectors, the cloud computing specialists - the ones who recite eldritch formulas like "Mongo", "Postgres" or "Kubernetes" and cast the Summon Money spell. (Unfortunately, Summon Greater Money requires making a pact with an archfiend, such as Microgle or Goosoft).

Two of the talks I attended today were about the connection between a massive database and a user-facing customer application:

  • A MongoDB driver to asynchronously carry data from client to server
  • A web interactive map that tracks public transit, called Catenary and which needs to communicate with city APIs that potentially all use conflicting data formats

I was quite awed by what I witnessed. However:

  • Interestingly, while most talks were "here is how you can use this Rust tool/feature in your own project", these two stood out from the lot by being "here is this cool thing we built using Rust". Because the audience of RustConf was composed of Rust developers (I hope), I imagine presenting a project like this would require fighting a little harder to keep the audience's interest.
  • The talks had a "walk me through your call stack" feel, especially the MongoDB one. This is a really deep dive - and therefore technically interesting to anyone with specialized experience wishing to do something like this on their own. But, for those more familiar with different realms of computing, I felt a bit like constantly journeying deeper in a thick forest, and asking "Where did I come from"?

A word of appreciation to the Catenary panelist for having bilingual (English/French) slides in his presentation - I felt honoured by this nod to the culture of my home city (Montréal).

Interlude

Dear people who code during a coding conference: please show mercy. Please indicate which sacrifices are required to satiate your eldritch thirst. Your zeal is beyond human comprehension.

All That Work Because I'm Too Lazy To Press One Key

I truly got to appreciate rustfmt last summer when contributing to the Rust central repository for my Makefile rewrite project. The CI job known as tidy isn't too enthusiastic about my lines of code spanning the entire circumference of Earth in their length.

Today, I got to witness just how many cogs start turning when I mindlessly type ":w" (yes, not Ctrl-S, I know, I'm so 1337) and see all the little words satisfyingly snap into place. First, the talk mentioned that mere strings are not sufficient to direct proper formatting. rustfmt needs to generate its own IR (intermediate representation) - a concept normally reserved to compilers - and have a rough understanding of the code's logic to then output back a fully formatted string sequence corresponding exactly to the parsed, messy string.

There is zero room for error - a formatter changing the way code is interpreted by the compiler, even in an extremely subtle way, would be a sad way to crash the latest Blazingly Fast™ NASA satellite written by an excited Rustacean intern.

Because of this parity requirement, some dilemmas arise:

struct Otter {
  eyes: Vec<Eye>,
  tail: Tail, // Don't worry, the Tail field can be removed later.
  cute: bool,
}

Let's say that this comment is too long and must be moved to the line under or above. But how can you choose? The formatter doesn't understand English. (Unless your compiler is simultaneously a chatbot - opinions on the genius and/or lunacy of such a technology will not be the subject of this post). Compilers don't have to take comments into account, formatters do.

Next, there are macros. They appear in their non-extended state to the formatter, while the compiler sees them in their fully unrolled state. With this mismatch, formatting in such a way that won't cause a difference in the way the compiler parses your code is another challenge.

I really appreciated this talk. It shed light on how complex some of the quality-of-life tools we use can be.

Interlude

Yes. Let's have two conference rooms. One larger than the Sun with hundreds of chairs, and the other requiring a microscope to properly see. And let's put all the more technical panels in the small room. It will fill right up in milliseconds and the nerds will be sent to listen to the other talk.

Hmph. Sorry. Venting over.

Merge And Release, On Stage

I used to think there was an inverse correlation between technical skill and the ability to teach it. All seconds spent learning how to teach are spent not learning the material, are they not?

After the presentation on rkyv, I acknowledge there may be exceptions to this rule.

First, I must admit it took me an unreasonable amount of time until I realized it's called rkyv because it sounds like "archive" when you pronounce it. Before this revelation came unto me, I constantly mispelled it as "rykv" or "rkvy".

Now that this is out of the way, I loved this presentation. I simply must honour the charisma in running cargo publish to ship 0.8 to crates.io live on stage, a version that the panelist worked on for the last 2.5 years.

rkyv is a zero-copy deserialization framework for Rust. A deserialization crate without the deserialization part. A rawer, more performant version of Serde, if you will. Not that the archives it outputs are human-readable, unlike the latter.

The concept itself is extremely simple at its core. Take data (like a struct), shove it in a [u8] (slice of bytes), and unpack later. This sounds so simple I wondered why it wasn't more widespread, until I was presented how uncanny some of the edge cases can get:

  • Absolute pointers like *const cannot be arbitrarily shoved in a slice, as they contain a memory address. Wrap them up nicely in a Box, perhaps? Now, you must deal with machine-specific endianness, because some computers read left-to-right and others right-to-left.

Small tangent: grabbing Arabic numbers from the Arabs and not keeping the right-to-left reading direction (specifically for numbers) was a mistake. Let's say I present to you the number 5XXX(an n number of further X digits). What's that? Can't see the last digits? I'm hiding them with the palm of my metaphorical hand, tough luck. With big-endian (left-to-right), all you know is that it starts with 5, but you're not even sure if that's a 5000 or a 500 000. With little-endian (right-to-left), you know that the number ends with 5 and is therefore divisible by 5. More data collected per digit!

Anyhow. The live-published on stage version, 0.8, fixes this irregularity by enforcing endianness and wrapping of absolute pointers automatically. Go try it in your projects! Perhaps you'll be happy with the performance gains.

I loved the final optimistic note of this talk. The developer promised to release in one year... back in 2022. Then, he was reminded of the often forgotten truth in software development that "80% done is actually 20% done" and got stuck for a while.

But. During all that time, rkyv stayed. It didn't regress, it didn't rot. It just waited for the right time. And that time came, today.

That makes me feel a lot better about my own abandoned on-hiatus projects.

Conclusion

It's not over. I'll be back tomorrow for more fun, more networking, more crab pinching with the hand to fire up the audience. I'll be giving a small "community talk" about my Rustc test suite rewrite project at 14:45 (2:45 PM) in the tiny room connected to the main ballroom. I'd be delighted to see familiar (or new!) faces.

This has been an amazing day.

Reddit: u/oneirical

Discord: oneirical