#cargo-metadata #cargo-toml #serde

cargo-manifest

Helper crate to parse and manipulate manifests - Cargo.toml files

38 releases (20 breaking)

0.21.0 Apr 12, 2026
0.20.0 Dec 30, 2025
0.19.1 Jan 16, 2025
0.17.0 Nov 28, 2024
0.2.1 Nov 29, 2020

#68 in Parser implementations

Download history 51197/week @ 2026-01-23 51992/week @ 2026-01-30 54350/week @ 2026-02-06 50912/week @ 2026-02-13 58448/week @ 2026-02-20 70764/week @ 2026-02-27 71573/week @ 2026-03-06 69477/week @ 2026-03-13 61393/week @ 2026-03-20 61418/week @ 2026-03-27 60572/week @ 2026-04-03 71732/week @ 2026-04-10 75723/week @ 2026-04-17 72481/week @ 2026-04-24 68203/week @ 2026-05-01 86853/week @ 2026-05-08

316,894 downloads per month
Used in 192 crates (30 directly)

Apache-2.0 OR MIT

58KB
1K SLoC

cargo-manifest

serde definitions to read and write Cargo.toml files.

Description

This Rust crate contains various structs and enums to represent the contents of a Cargo.toml file. These definitions can be used with serde and the toml crate to read and write Cargo.toml manifest files.

This crate also to some degree supports post-processing of the data to emulate Cargo's workspace inheritance and autobins features. This is used for example by crates.io to extract whether a crate contains a library or executable binaries.

Note

The cargo team regularly adds new features to the Cargo.toml file definition. This crate aims to keep up-to-date with these changes. You should keep this crate up-to-date to correctly parse all fields in modern Cargo.toml files.

Installation

cargo add cargo-manifest

Usage

use cargo_manifest::Manifest;

let manifest = Manifest::from_path("Cargo.toml").unwrap();

see docs.rs for more information.

Users

Alternatives

This crate is a fork of the cargo_toml project. There are only some minor differences between these projects at this point, you will need to evaluate which one fits your needs better.

There is also cargo-util-schemas now, which is maintained by the cargo team themselves. This crate was extracted from the cargo codebase and is used inside the cargo binary itself. It is kept up-to-date with the latest changes to the Cargo.toml file format, but is currently lacking some of the post-processing features that cargo-manifest provides.

License

This project is licensed under either of

at your option.

Dependencies

~2.3–3MB
~73K SLoC