Crate cargo_toml

source ·
Expand description

This crate defines structs that can be deserialized with Serde to load and inspect Cargo.toml metadata.

See Manifest::from_slice.

Correct interpretation of the manifest requires two things:

  • List of files in order to auto-discover binaries, examples, benchmarks, and tests.
  • Potentially Manifest from parent directories that acts as a workspace root for inheritance of shared workspace information.

The crate has methods for processing this information, but you will need to write some glue code to obtain it. See Manifest::complete_from_path_and_workspace.

Modules§

  • featuresfeatures
    Helper for parsing the microsyntax of the [features] section and computing implied features from optional dependencies.

Structs§

  • In badges section of Cargo.toml
  • [badges] section of Cargo.toml, deprecated by crates-io except maintenance.
  • When definition of a dependency is more than just a version string.
  • AbstractFilesystem implementation for real files.
  • When a dependency is defined as { workspace = true }, and workspace data hasn’t been applied yet.
  • [lints] section.
  • The top-level Cargo.toml structure. This is the main type in this library.
  • The [package] section of the Manifest. This is where crate properties are.
  • Workspace can predefine properties that can be inherited via { workspace = true } in its member packages.
  • Cargo uses the term “target” for both “target platform” and “build target” (the thing to build), which makes it ambigous. Here Cargo’s bin/lib target is renamed to product.
  • Compilation/optimization settings for a workspace
  • Build-in an custom build/optimization settings
  • Dependencies that are platform-specific or enabled through custom cfg().
  • A manifest can contain both a package and workspace-wide properties

Enums§

  • Verbosity of debug info in a Profile
  • Dependency definition. Note that this struct doesn’t carry it’s key/name, which you need to read from its section.
  • Edition setting, which opts in to new Rust/Cargo behaviors.
  • In this crate’s Results.
  • Placeholder for a property that may be missing from its package, and needs to be copied from a Workspace.
  • Lint definition.
  • Lint level.
  • Handling of LTO in a build profile
  • Mainly used to deprecate crates.
  • A way specify or disable README or build.rs.
  • Forbids or selects custom registry
  • resolver = "2" setting. Needed in Workspace, but implied by Edition in packages.
  • Handling of debug symbols in a build profile
  • Representation of a TOML value.

Traits§

  • This crate supports reading Cargo.toml not only from a real directory, but also directly from other sources, like tarballs or bare git repos (BYO directory reader).

Type Aliases§

  • Dependencies. The keys in this map are not always crate names, this can be overriden by the package field, and there may be multiple copies of the same crate. Optional dependencies may create implicit features, see the features module for dealing with this.
  • The [features] section. This set may be incomplete!
  • Lint groups such as [lints.rust].
  • A set of lints.
  • Locally replace dependencies
  • Config target (see parse_cfg crate) + deps for the target.