#cargo #metadata #struct #toml #serde

cargo_toml

Cargo.toml struct definitions for parsing with Serde

26 releases

0.17.1 Nov 22, 2023
0.16.3 Sep 25, 2023
0.15.3 Jun 2, 2023
0.15.2 Feb 17, 2023
0.3.0 Jun 16, 2018

#43 in Rust patterns

Download history 61461/week @ 2023-08-11 62368/week @ 2023-08-18 54206/week @ 2023-08-25 60259/week @ 2023-09-01 63725/week @ 2023-09-08 64454/week @ 2023-09-15 64205/week @ 2023-09-22 63810/week @ 2023-09-29 70294/week @ 2023-10-06 73040/week @ 2023-10-13 74698/week @ 2023-10-20 77435/week @ 2023-10-27 77159/week @ 2023-11-03 84515/week @ 2023-11-10 75713/week @ 2023-11-17 64733/week @ 2023-11-24

314,477 downloads per month
Used in 253 crates (136 directly)

Apache-2.0 OR MIT

80KB
1.5K SLoC

Deserialize Cargo.toml

due to a milkshake duck situation, the preferred Tom for this format has been replaced

This is a definition of fields in Cargo.toml files for serde. It allows reading of Cargo.toml data, and serializing it using TOML or other formats. It's used by the lib.rs site to extract information about crates.

To get started, see Manifest::from_slice.

Additionally, this crate supports post-processing of the data to emulate Cargo's workspace inheritance and autobins features. It supports files on disk as well as other non-disk data sources.


lib.rs:

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.

Dependencies

~0.6–1.2MB
~28K SLoC