feature-scope Macros
Procedural macros for the feature-scope library that enables workspace crates to
independently control their required features without cross-package interference.
Overview
This crate provides the #[feature_scope] and #[feature_scope_default] attribute macros
that allow you to conditionally compile code based on feature flags defined in your Cargo.toml.
Configuration
This library uses a two-step configuration approach:
- Declare features in library crates using
package.metadata.feature-scope-decl:
# In your library crate's Cargo.toml
[]
= ["a"]
= []
= []
= []
- Configure feature usage in consumer crates using
package.metadata.feature-scope:
# In your binary/consumer crate's Cargo.toml
[[]]
= "your-library-name"
= ["b"]
= false
Usage
Use the macros in your library code:
use ;
Build Commands
Use cargo feature-scope commands instead of regular cargo commands to build your project: