Expand description
manifest-feature-gen helps generating features of cargo manifest
§Usage
use manifest_feature_gen::{Manifest, ToFeatureName};
enum Features {
Feature1,
Feature2,
}
impl ToFeatureName for Features {
fn to_feature_name(&self) -> String {
match self {
Features::Feature1 => "feature1".to_string(),
Features::Feature2 => "feature2".to_string(),
}
}
}
fn main() -> Result<(), manifest_feature_gen::Error> {
let mut manifest = Manifest::new("Cargo.toml")?;
let optional_features = manifest.add_features([
Features::Feature1,
Features::Feature2,
].into_iter(), |_, _| {}).unwrap();
manifest.write()?;
Ok(())
}
Structs§
- Build
Script Export Descriptor - Build script export descriptor. It describes how to export features to build script.
- Dependency
Helper - This helper provides some safe way to specify dependency of generated feature
- Manifest
- Cargo manifest representation for editing features.
- Manifest
With Build Script - Cargo manifest representation for generating features on out of build script
- Manifest
With Feature Collector - Cargo manifest representation for generating feature on build script.
Enums§
- Dependency
Error - Possible dependency error from
DependencyHelper
- Error
- Possible errors while using manifest-feature-gen
Traits§
- ToFeature
Name - Provide feature name for write to cargo manifest. Recommend write in snake_case or kebab-case