Why does the "crate" nomenclature include both "binary" and "library"?

52 points Sn34kyMofo

I started actively learning Rust a few months back, so I'm still new to a lot of the how's and why's. Up to this point, I was under the impression that a crate was directly equivalent to a library. Well, today, I was reading a book that defined a crate as a program. Before suggesting it was errata, I decided to look into the statement. That landed me in the Packages and Crates chapter of "the book". Therein is a quote in the third paragraph that states the following:

Most of the time when Rustaceans say “crate”, they mean library crate, and they use “crate” interchangeably with the general programming concept of a “library".

That seems to correlate why I've come to think of a crate as equivalent to a library: it's all I've seen up to this point.

I'm now a bit confused by the decision of Rust's creator(s) to combine "binary" and "library" under the umbrella term of "crate" in the first place. I see what it's saying at face value, but it just seems like an unnecessary nomenclature for one term ("crate") to possibly have two very distinct meanings: a binary or a library.

So now it seems like "crate", by itself, has sort of landed to implicitly mean "library" throughout all the places I've generally encountered crates.

I'm confident I'm missing something here insofar as Rust's origins and the decision for "crate" to be defined as it is. If anyone can elaborate, I would be grateful. I feel this is a matter of my own subjective progress, and lack of perspective and historical context regarding Rust.

The intention here isn't to bag on the creators or the nomenclature itself; I'm just interested in learning about the decision and perhaps how to properly view and use the term in the context of how it was intended (as opposed to the eventuality of it becoming more or less synonymous with "library").

Should we all explicitly be saying "library crate" (instead of "crate") and "binary crate" (instead of some variation of "Rust binary")? Perhaps I'm just overthinking this, lol.

Thank you!