logoalt Hacker News

SAI_Peregrinustoday at 2:16 PM1 replyview on HN

A "ton of crates" is IMO the best way to write large Rust programs. Each crate in Rust is a compilation unit, the equivalent of one `.c` file in C. If they don't depend on one another, each crate can be compiled in parallel. It makes building the whole project faster, often significantly so. As with anything one can take it too far, but as long as each crate makes sense as an independent unit it's good.


Replies

loegtoday at 3:01 PM

Isn't creating a bunch of crates pretty annoying, logistically (in terms of mandatory directory structure and metadata files per crate)? (Compared with C/C++ individual .c/.cpp files being compilation units.) And does parallel compilation of crates break LTO?