Rust "project" vs "package" vs "program"

Trying to understand the terminology. Both the NoStarch "Rust Programming Language" book and the O'Reilly "Programming Rust" book make frequent use of the term "project" without really defining it (or maybe I just didn't see it...). There are definitions for packages, crates and modules, but not for projects. The term "project" doesn't even appear in the index of either book. "Cargo" creates crates and packages and all that seems to be called a project in a project directory.

I'm going to take a guess at a definition:
"A project (lower-case 'p') is an unofficial name for a directory structure containing zero or more Packages (upper-case 'P'). A program (lower-case 'p') is the executable output that is generated when all the Packages in a project are successfully compiled."

Neither “project” nor “program” are formal terms within the world of Rust/Cargo; “package” is.

I would generally say that “project” means “the directory structure containing the files you're working on as part of a single thing” — this might be a single Cargo package, a workspace of many packages, multiple workspaces, or even a Cargo package/workspace together with non-Rust (e.g. JavaScript, or C) files. A “project” might often coincide with a version control repository.

Also, “project” is often a formal term to an IDE (not Cargo) for some specific entity within that IDE's configuration.

I would say that a “program” is not specifically the executable; rather, the executable is one possible form of a program. The source code, that could be compiled to create that executable, is also a form of the same program.

I strongly recommend not trying to interpret “project” or “program” as formal terms with precise definitions; that will just lead to additional confusion. Interpret what the particular author means from context and experience.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.