Blog Post: Zig And Rust

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • zig

    General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

  • Simplicity again, but this time via expressiveness of comptime. A lot of type-level things which are complex in Rust would be natural in Zig. An example here is this PR, where I make a bunch of previously concrete types generic over a family of types. In Zig, that amounts to basically wrapping the code into a function which accepts a (comptime type) parameter. That's a bog standard mechanical generalization. In Rust, doing something like that would require me to define a bunch of traits, probably with GATs, spelling out huge where clauses, etc. Of course, with Zig I don't have a nice declaration-time error, but the thing is, the complexity of the code I am getting an error is different. In Rust, I deal with a complex type-level program which has a nice, in principle, error. In Zig, the error is worse, but, as the program itself is simpler, the end result is not as clear cut. The situations flips if we go complex cases. In Zig, AOS<->SOA transformation is just slightly-clever code, in Rust, that would require leaving the language of types and entering the language of macros.

  • tigerbeetle

    The distributed financial transactions database designed for mission critical safety and performance.

  • Simplicity This is really the big one. Zig's code tends to be exceptionally easy to read: there are no lambdas, there are no macros, there's just code. TigerBeetle's io_uring-based IO module is a good example here. Additionally, when it comes to nuts-and-bolts of syntax, I feel that Zig has an edge over Rust:

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts