|
| 1 | +# Glossary |
| 2 | + |
| 3 | +### Artifact |
| 4 | + |
| 5 | +An *artifact* is the file or set of files created as a result of the |
| 6 | +compilation process. This includes linkable libraries and executable binaries. |
| 7 | + |
| 8 | +### Crate |
| 9 | + |
| 10 | +Every target in a package is a *crate*. Crates are either libraries or |
| 11 | +executable binaries. It may loosely refer to either the source code of the |
| 12 | +target, or the compiled artifact that the target produces. A crate may also |
| 13 | +refer to a compressed package fetched from a registry. |
| 14 | + |
| 15 | +### Edition |
| 16 | + |
| 17 | +A *Rust edition* is a developmental landmark of the Rust language. The |
| 18 | +[edition of a package][edition-field] is specified in the `Cargo.toml` |
| 19 | +manifest, and individual targets can specify which edition they use. See the |
| 20 | +[Edition Guide] for more information. |
| 21 | + |
| 22 | +### Feature |
| 23 | + |
| 24 | +A [*feature*][feature] is a named flag which allows for conditional |
| 25 | +compilation. A feature can refer to an optional dependency, or an arbitrary |
| 26 | +name defined in a `Cargo.toml` manifest that can be checked within source |
| 27 | +code. |
| 28 | + |
| 29 | +Cargo has [*unstable feature flags*][cargo-unstable] which can be used to |
| 30 | +enable experimental behavior of Cargo itself. The Rust compiler and Rustdoc |
| 31 | +also have their own unstable feature flags (see [The Unstable |
| 32 | +Book][unstable-book] and [The Rustdoc Book][rustdoc-unstable]). |
| 33 | + |
| 34 | +### Index |
| 35 | + |
| 36 | +The index is the searchable list of crates in a registry. |
| 37 | + |
| 38 | +### Lock file |
| 39 | + |
| 40 | +The `Cargo.lock` *lock file* is a file that captures the exact version of |
| 41 | +every dependency used in a workspace or package. It is automatically generated |
| 42 | +by Cargo. See [Cargo.toml vs Cargo.lock]. |
| 43 | + |
| 44 | +### Manifest |
| 45 | + |
| 46 | +A [*manifest*][manifest] is a description of a package or a workspace in a |
| 47 | +file named `Cargo.toml`. |
| 48 | + |
| 49 | +A [*virtual manifest*][virtual] is a `Cargo.toml` file that only describes a |
| 50 | +workspace, and does not include a package. |
| 51 | + |
| 52 | +### Member |
| 53 | + |
| 54 | +A *member* is a package that belongs to a workspace. |
| 55 | + |
| 56 | +### Package |
| 57 | + |
| 58 | +A *package* is a collection of source files and a `Cargo.toml` manifest which |
| 59 | +describes the package. A package has a name and version which is used for |
| 60 | +specifying dependencies between packages. A package contains multiple targets, |
| 61 | +which are either libraries or executable binaries. |
| 62 | + |
| 63 | +The *package root* is the directory where the package's `Cargo.toml` manifest |
| 64 | +is located. |
| 65 | + |
| 66 | +The [*package id specification*][pkgid-spec], or *SPEC*, is a string used to |
| 67 | +uniquely reference a specific version of a package from a specific source. |
| 68 | + |
| 69 | +### Project |
| 70 | + |
| 71 | +Another name for a [package](#package). |
| 72 | + |
| 73 | +### Registry |
| 74 | + |
| 75 | +A *registry* is a service that contains a collection of downloadable crates |
| 76 | +that can be installed or used as dependencies for a package. The default |
| 77 | +registry is [crates.io](https://crates.io). The registry has an *index* which |
| 78 | +contains a list of all crates, and tells Cargo how to download the crates that |
| 79 | +are needed. |
| 80 | + |
| 81 | +### Source |
| 82 | + |
| 83 | +A *source* is a provider that contains crates that may be included as |
| 84 | +dependencies for a package. There are several kinds of sources: |
| 85 | + |
| 86 | +- **Registry source** — See [registry](#registry). |
| 87 | +- **Local registry source** — A set of crates stored as compressed files on |
| 88 | + the filesystem. See [Local Registry Sources]. |
| 89 | +- **Directory source** — A set of crates stored as uncompressed files on the |
| 90 | + filesystem. See [Directory Sources]. |
| 91 | +- **Path source** — An individual package located on the filesystem (such as a |
| 92 | + [path dependency]) or a set of multiple packages (such as [path overrides]). |
| 93 | +- **Git source** — Packages located in a git repository (such as a [git |
| 94 | + dependency] or [git source]). |
| 95 | + |
| 96 | +See [Source Replacement] for more information. |
| 97 | + |
| 98 | +### Spec |
| 99 | + |
| 100 | +See [package id specification](#package). |
| 101 | + |
| 102 | +### Target |
| 103 | + |
| 104 | +The meaning of the term *target* depends on the context: |
| 105 | + |
| 106 | +- **Cargo Target** — Cargo packages consist of *targets* which correspond to |
| 107 | + artifacts that will be produced. Packages can have library, binary, example, |
| 108 | + test, and benchmark targets. The [list of targets][targets] are configured |
| 109 | + in the `Cargo.toml` manifest, often inferred automatically by the [directory |
| 110 | + layout] of the source files. |
| 111 | +- **Target Architecture** — The OS and machine architecture for the built |
| 112 | + artifacts are typically referred to as a *target*. |
| 113 | +- **Target Triple** — A triple is a specific format for specifying a target |
| 114 | + architecture. See the [clang documentation] for details. Triples may be |
| 115 | + referred to as a *target triple* which is the architecture for the artifact |
| 116 | + produced, and the *host triple* which is the architecture that the compiler |
| 117 | + is running on. The target triple can be specified with the `--target` |
| 118 | + command-line option or the `build.target` [config option]. |
| 119 | +- **Target Directory** — Cargo places all built artifacts and intermediate |
| 120 | + files in the *target* directory. By default this is a directory named |
| 121 | + `target` at the workspace root, or the package root if not using a |
| 122 | + workspace. The directory be changed with the `--target` command-line option, |
| 123 | + the `CARGO_TARGET_DIR` [environment variable], or the `build.target-dir` |
| 124 | + [config option]. |
| 125 | + |
| 126 | +### Test Targets |
| 127 | + |
| 128 | +Cargo *test targets* generate binaries which help verify proper operation and |
| 129 | +correctness of code. There are two types of test artifacts: |
| 130 | + |
| 131 | +* **Unit test** — A *unit test* is an executable binary compiled directly from |
| 132 | + a library or a binary target. It contains the entire contents of the library |
| 133 | + or binary code, and runs `#[test]` annotated functions, intended to verify |
| 134 | + individual units of code. |
| 135 | +* **Integration test target** — An [*integration test |
| 136 | + target*][integration-tests] is an executable binary compiled from a *test |
| 137 | + target* which is a distinct crate whose source is located in the `tests` |
| 138 | + directory or specified by the [`[[test]]` table][targets] in the |
| 139 | + `Cargo.toml` manifest. It is intended to only test the public API of a |
| 140 | + library, or execute a binary to verify its operation. |
| 141 | + |
| 142 | +### Workspace |
| 143 | + |
| 144 | +A [*workspace*][workspace] is a collection of one or more packages that share |
| 145 | +common dependency resolution (with a shared `Cargo.lock`), output directory, |
| 146 | +and various settings such as profiles. |
| 147 | + |
| 148 | +A [*virtual workspace*][virtual] is a workspace where the root `Cargo.toml` |
| 149 | +manifest does not define a package, and only lists the workspace members. |
| 150 | + |
| 151 | +The *workspace root* is the directory where the workspace's `Cargo.toml` |
| 152 | +manifest is located. |
| 153 | + |
| 154 | + |
| 155 | +[Cargo.toml vs Cargo.lock]: guide/cargo-toml-vs-cargo-lock.html |
| 156 | +[Directory Sources]: reference/source-replacement.html#directory-sources |
| 157 | +[Local Registry Sources]: reference/source-replacement.html#local-registry-sources |
| 158 | +[Source Replacement]: reference/source-replacement.html |
| 159 | +[cargo-unstable]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html |
| 160 | +[clang documentation]: http://clang.llvm.org/docs/CrossCompilation.html#target-triple |
| 161 | +[config option]: reference/config.html |
| 162 | +[directory layout]: reference/manifest.html#the-project-layout |
| 163 | +[edition guide]: https://rust-lang-nursery.github.io/edition-guide/ |
| 164 | +[edition-field]: reference/manifest.html#the-edition-field-optional |
| 165 | +[environment variable]: reference/environment-variables.html |
| 166 | +[feature]: reference/manifest.html#the-features-section |
| 167 | +[git dependency]: reference/specifying-dependencies.html#specifying-dependencies-from-git-repositories |
| 168 | +[git source]: reference/source-replacement.html |
| 169 | +[integration-tests]: reference/manifest.html#integration-tests |
| 170 | +[manifest]: reference/manifest.html |
| 171 | +[path dependency]: reference/specifying-dependencies.html#specifying-path-dependencies |
| 172 | +[path overrides]: reference/specifying-dependencies.html#overriding-with-local-dependencies |
| 173 | +[pkgid-spec]: reference/pkgid-spec.html |
| 174 | +[rustdoc-unstable]: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html |
| 175 | +[targets]: reference/manifest.html#configuring-a-target |
| 176 | +[unstable-book]: https://doc.rust-lang.org/nightly/unstable-book/index.html |
| 177 | +[virtual]: reference/manifest.html#virtual-manifest |
| 178 | +[workspace]: reference/manifest.html#the-workspace-section |
0 commit comments