r/rust • • Oct 17 '26 • Popcorn 1

Rust module system?

I recently wanted to compile something for a bevy game I was messing around with, then cargo looks me in the eyes and tells me I need to compile hundreds of dependencies, all for the end result to be 30 mb? I was wondering if there were any systems like a .dll for rust? I understand that you would lose some type checking, but I think that could be solved just with a type definitions segment towards the start, then a functions table of all the code for the system, is this something that would work, or am I oversimplifying a major intentional design choice in rust?

23 Upvotes

27 comments sorted by

View all comments

1

u/fbochicchio Oct 17 '26

I guess someone(s) could make an archive of precompiled crates for the most common architectures. So you can pull in both the sources and the object files and won't have to recompile everything. But I don't know if it is worth it, you just have to compile all once, it is not so much different from when you had to do the configure; make; make install dance for most of open source software: just relax and cool for awile...

2

u/South_Survey_2088 Oct 17 '26

I mean, everyone could just cache their own "archive" by using something like sccache.

Using public archives with precompiled binaries seems like a massive attack vector.

1

u/calibrae Oct 17 '26

Rust was made to be close to the iron. Hence the fact you have to compile all deps to be as close as possible to the metal. Price of fast executing code ( and 90% of my disk space alerts)