Crate feature_check[−][src]
Expand description
Query a program for supported features.
The obtain::obtain_features
function queries a program for the features that it supports
via various methods (e.g. running it with the --features
command-line option) and allows other programs to check for
the presence and, possibly, versions of specific features.
use feature_check::defs; use feature_check::obtain; match obtain::obtain_features(&defs::Config { program: "confget".to_string(), ..defs::Config::default() })? { defs::Obtained::NotSupported => eprintln!("Feature query not supported"), defs::Obtained::Failed(err) => eprintln!("Could not query for features: {}", err), defs::Obtained::Features(res) => { let mut features: Vec<&String> = res.keys().collect(); features.sort_unstable(); for name in &features { println!("{}", name); } } }
Modules
defs | Common definitions for the feature-check crate’s modules. |
expr | Check whether the program’s features satisfy the specified condition. |
obtain | Query a program for its features. |
version | Parse version strings and compare them. |