#config #derive-config #cargo

derive-project-config

Read [package.metadata.*] config from Cargo.toml for derive macros

2 unstable releases

new 0.1.0 Mar 15, 2026
0.0.0-alpha.3 Mar 15, 2026

#1164 in Procedural macros

MIT license

5KB

Read [package.metadata.<tool>] config from Cargo.toml for derive macros.

Proc macros run at compile time and can read CARGO_MANIFEST_DIR to find the project's Cargo.toml. This crate provides a generic reader that:

  1. Reads [package.metadata.<tool>] from the compiling crate's Cargo.toml
  2. Falls back to [workspace.metadata.<tool>] in the workspace root
  3. Caches the result for the compilation session
use derive_project_config::read_metadata;

let table = read_metadata("flowjs-rs");
if let Some(val) = table.and_then(|t| t.get("opaque_newtypes")) {
    // use val
}

Dependencies

~445–750KB
~17K SLoC