Skip to main content

features_env

Function features_env 

Source
pub fn features_env(cargo: &str)
Available on crate feature build only.
Expand description

Builds the CARGO_FEATURES environment variable.

This function turns enabled cargo features into a simple string +feature1 +feature2 +featureN, which then exposes it via the CARGO_FEATURES environment variable.

It first reads and parses the Cargo.toml in order to extract all available features (omitting “default”). It then checks for enabled features via CARGO_FEATURE_<name> to finally collect them into a string.