#cargo-manifest #features #generator

build manifest-feature-gen

Feature generator for cargo manifest

6 releases

0.3.0 Mar 26, 2025
0.2.0 Aug 8, 2024
0.1.3 Nov 14, 2023
0.1.2 Dec 13, 2022

#322 in Build Utils

Download history 1432/week @ 2025-06-07 1740/week @ 2025-06-14 775/week @ 2025-06-21 1615/week @ 2025-06-28 809/week @ 2025-07-05 520/week @ 2025-07-12 357/week @ 2025-07-19 589/week @ 2025-07-26 1022/week @ 2025-08-02 279/week @ 2025-08-09 313/week @ 2025-08-16 859/week @ 2025-08-23 908/week @ 2025-08-30 301/week @ 2025-09-06 387/week @ 2025-09-13 798/week @ 2025-09-20

2,609 downloads per month

Custom license

28KB
538 lines

manifest-feature-gen

manifest-feature-gen helps generating features of cargo manifest


lib.rs:

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(())
}

Dependencies

~1.4–2MB
~40K SLoC