32 releases (16 breaking)

0.17.0 Nov 28, 2024
0.16.0 Oct 31, 2024
0.15.0 Jun 29, 2024
0.14.0 Mar 29, 2024
0.2.1 Nov 29, 2020

#48 in Parser implementations

Download history 13699/week @ 2024-08-19 15262/week @ 2024-08-26 15485/week @ 2024-09-02 15835/week @ 2024-09-09 16393/week @ 2024-09-16 17926/week @ 2024-09-23 19905/week @ 2024-09-30 20269/week @ 2024-10-07 24921/week @ 2024-10-14 22397/week @ 2024-10-21 23906/week @ 2024-10-28 24822/week @ 2024-11-04 24021/week @ 2024-11-11 24680/week @ 2024-11-18 24177/week @ 2024-11-25 24492/week @ 2024-12-02

98,227 downloads per month
Used in 144 crates (15 directly)

Apache-2.0 OR MIT

56KB
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
~63K SLoC