Why Not Rust?

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

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

    The official GitHub mirror of the Chromium source

  • Ah yes you're right, this is old code written as recently way back... 21 hours ago https://github.com/chromium/chromium/commit/a756e0e0c8a2505d...

    "old" and "nobody" are gaining fascinating new meanings, today

  • rust-bindgen

    Automatically generates Rust FFI bindings to C (and some C++) libraries.

  • Bitfields are hard! They are potentially unaligned, thus interact poorly with some language features, like pointers and references. And their size isn't a multiple of bytes, unlike any other value, which causes problems as well. They interact poorly with padding and the general idea of Rust ABIs that enables optimizations like reordering fields and using "niches" (invalid values) to find a more compact layout for structs and enums.

    I agree Rust should eventually have some native support for bitfields, but only if it's a high quality spec that addresses the outstanding concerns - Rust should specifically avoid the C mess, which isn't usable for most projects.

    But this doesn't mean bitfields can't be done in Rust; it's just not in the stdlib (yet). See this post[0] which contains a survey of various libraries (and their respective limitations), and this slightly older article [1]. Those articles somehow missed the modular-bitfield crate [2], which is perhaps the nicest to use, and is what I would recommend you.

    If you don't care about the specifics you can get any crate discussed in the above articles and use them.

    About interoperability with C (and C++), I really like bindgen, cbindgen and cxx. The bindgen book [3] is straighforward. This section of cxx documentation [4] also describes the tradeoffs between the different FFI approaches. I don't know Ada though, so I must ask: what does Ada do?

    About this,

    > I just don't see what Rust has to offer that Ada didn't already address.

    Off the top of my head, the crates ecosystem, the borrow checker, sum types with pattern matching [5], a stellar story for error handling (beats any language I know hands down - that is, if you use crates like thiserror and anyhow).

    [0] https://immunant.com/blog/2020/01/bitfields/

    [1] https://myrrlyn.net/blog/misc/bitfields-in-rust

    [2] https://crates.io/crates/modular-bitfield

    [3] https://rust-lang.github.io/rust-bindgen/

    [4] https://cxx.rs/context.html

    [5] https://chadaustin.me/2015/07/sum-types/

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • makepad

    Makepad is a creative software development platform for Rust that compiles to wasm/webGL, osx/metal, windows/dx11 linux/opengl

  • When it comes to compile times, the most optimized Rust codebase I know for optimized for this is makepad.dev [1].

    It is compiling from scratch on mac m1 in around 7.5s [2] and that's +100k lines of Rust. However there is close to none dependencies, so this +100k is all there is to compile pretty much.

    [1] https://makepad.dev/

    [2] https://twitter.com/rikarends/status/1467529091284934666

  • heappy

    heap profiler for rust (by mkmik)

  • > But, for example, some runtime-related tools (most notably, heap profiling) are just absent — it’s hard to reflect on the runtime of the program if there’s no runtime!

    Yeah; I felt that pain too.

    I tried to write something to address some parts of the missing space. It's still in the early stages but you may be interested:

    https://github.com/mkmik/heappy

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