← Back to context

Comment by epage

6 years ago

-sys are raw wrappers around C code so wouldn't provide much benefit for them to be exposed as dynlibs.

And crates are the equivelant of python, node, go, etc packages. That they are also a compilation unit is, I believe, an implementation detail. I think they also made it configurable.

A crate is a compilation unit. A package is defined by a Cargo.toml, and can have one or more crates.

Most folks use “package” and “crate” interchangeably, even if they’re technically different.

See the bottom of https://doc.rust-lang.org/book/ch07-00-managing-growing-proj...

(Additionally, “compilation unit” is a bit weird, given incremental compilation, etc. “the file containing the root module tree that gets passed to rustc” is not as succinct though.)

We can split one crate into multiple units for better paralleization, but I don't think there is a way to put multiple into a single compilation unit.