Glossary

    Crate

    Every target in a package is a crate. Crates are either libraries orexecutable binaries. It may loosely refer to either the source code of thetarget, or the compiled artifact that the target produces. A crate may alsorefer to a compressed package fetched from a registry.

    Edition

    A Rust edition is a developmental landmark of the Rust language. The is specified in the manifest, and individual targets can specify which edition they use. See theEdition Guide for more information.

    Feature

    The meaning of feature depends on the context:

    • A is a named flag which allows for conditionalcompilation. A feature can refer to an optional dependency, or an arbitraryname defined in a Cargo.toml manifest that can be checked within sourcecode.

    • Cargo has unstable feature flags which can be used toenable experimental behavior of Cargo itself.

    • The Rust compiler and Rustdoc have their own unstable feature flags (see and The RustdocBook).

    • CPU targets have which specifycapabilities of a CPU.

    Index

    The index is the searchable list of crates in a registry.

    Manifest

    A manifest is a description of a package or a workspace in afile named Cargo.toml.

    A is a Cargo.toml file that only describes aworkspace, and does not include a package.

    Member

    A member is a package that belongs to a workspace.

    Package

    A package is a collection of source files and a Cargo.toml manifest whichdescribes the package. A package has a name and version which is used forspecifying dependencies between packages. A package contains multiple targets,which are either libraries or executable binaries.

    The package root is the directory where the package's Cargo.toml manifestis located.

    The package ID specification, or SPEC, is a string used touniquely reference a specific version of a package from a specific source.

    Project

    Another name for a .

    A registry is a service that contains a collection of downloadable cratesthat can be installed or used as dependencies for a package. The defaultregistry is crates.io. The registry has an index whichcontains a list of all crates, and tells Cargo how to download the crates thatare needed.

    Source

    • Registry source — See .
    • Local registry source — A set of crates stored as compressed files onthe filesystem. See Local Registry Sources.
    • Directory source — A set of crates stored as uncompressed files on thefilesystem. See .
    • Git source — Packages located in a git repository (such as a gitdependency or ).See Source Replacement for more information.

    Spec

    See .

    Target

    The meaning of the term target depends on the context:

    • Cargo Target — Cargo packages consist of targets which correspond toartifacts that will be produced. Packages can have library, binary, example,test, and benchmark targets. The list of targets are configuredin the Cargo.toml manifest, often inferred automatically by the of the source files.

    • Target Directory — Cargo places all built artifacts and intermediatefiles in the target directory. By default this is a directory namedtarget at the workspace root, or the package root if not using aworkspace. The directory may be changed with the —target-dir command-lineoption, the CARGO_TARGET_DIR environment variable, or thebuild.target-dir .

    • Target Architecture — The OS and machine architecture for the builtartifacts are typically referred to as a target.

    • Target Triple — A triple is a specific format for specifying a targetarchitecture. Triples may be referred to as a target triple which is thearchitecture for the artifact produced, and the host triple which is thearchitecture that the compiler is running on. The target triple can bespecified with the —target command-line option or the build.targetconfig option. The general format of the triple is<arch><sub>-<vendor>-<sys>-<abi> where:

      • = The base CPU architecture, for example x86_64, i686, arm,thumb, mips, etc.
      • sub = The CPU sub-architecture, for example arm has v7, v7s,v5te, etc.
      • vendor = The vendor, for example unknown, apple, pc, , etc.
      • sys = The system name, for example linux, windows, etc. none istypically used for bare-metal without an OS.
      • abi = The ABI, for example gnu, android, eabi, etc.Some parameters may be omitted. Run rustc —print target-list for a list ofsupported targets.

    Test Targets

    Cargo test targets generate binaries which help verify proper operation andcorrectness of code. There are two types of test artifacts:

    • Unit test — A unit test is an executable binary compiled directly froma library or a binary target. It contains the entire contents of the libraryor binary code, and runs #[test] annotated functions, intended to verifyindividual units of code.

    A is a collection of one or more packages that sharecommon dependency resolution (with a shared Cargo.lock), output directory,and various settings such as profiles.

    The workspace root is the directory where the workspace's Cargo.tomlmanifest is located.