Skip to main content

Crate list_features

Crate list_features 

Source
Expand description

Returns the list of enable features when building your crate.

The list_enabled_as_string function lists enabled features during the Cargo build process, in a format that can be directly saved in build artifacts, which can be then included elsewhere in the program and read at run time.

If you don’t like the output format provided by list_enabled_as_string, the list_enabled function will provide the list of enabled features as a Vec<String>.

Other functions are made available in case you prefer obtaining intermediate data (list_all) or need a custom path to Cargo.toml (list_enabled_as_string_with_path and list_enabled_with_path), but they’re probably not what you’re looking for.

§Examples

See the example included with the list_enabled_as_string function and the example crate

Functions§

list_all
Parses a Cargo.toml file and returns the set of declared feature names.
list_enabled
Returns the list of enabled features as a Vec<String>.
list_enabled_as_string
Generates a constant declaration containing enabled Cargo features.
list_enabled_as_string_with_path
Generates a constant declaration containing enabled Cargo features.
list_enabled_with_path
Returns the list of enabled features as a Vec<String>.