#cargo #cargo-subcommand #features #crates #cli

app cargo-feature

Cargo 插件,用于管理依赖功能

15 个不稳定版本 (6 个破坏性更新)

0.7.0 2022年5月9日
0.6.0 2021年10月31日
0.5.5 2021年10月26日
0.5.2 2021年4月8日
0.2.0 2020年3月25日

#360Cargo 插件 中排名

Download history 152/week @ 2024-03-13 117/week @ 2024-03-20 87/week @ 2024-03-27 102/week @ 2024-04-03 209/week @ 2024-04-10 308/week @ 2024-04-17 212/week @ 2024-04-24 418/week @ 2024-05-01 358/week @ 2024-05-08 324/week @ 2024-05-15 343/week @ 2024-05-22 160/week @ 2024-05-29 396/week @ 2024-06-05 240/week @ 2024-06-12 152/week @ 2024-06-19 99/week @ 2024-06-26

每月下载量 MIT 许可证

91KB

376
376

cargo-feature

CI Crates.io

Packaging status

preview

安装

Cargo

cargo安装 cargo-feature

Arch

pacman -Syu cargo-feature

NixOS

nix-env-iA nixos.cargo-feature

用法

# add serde_derive feature to build-dependency of serde
cargo feature -t build serde +serde_derive

# disable default-features
cargo feature serde ^default

# same as above but more explict
cargo feature serde --disable-default-features

# if you want list all features, just type crate name
cargo feature serde

# enable default-features
cargo feature serde default

# same as above but more explict
cargo feature serde --enable-default-features

# add HtmlDivElement feature to dependency of web_sys 
cargo feature web_sys +HtmlDivElement

# you can skip typing +
cargo feature web_sys HtmlDivElement

# same as above but use `target.'cfg(target_arch = "wasm32")'.dependencies`
cargo feature --target="cfg(target_arch = \"wasm32\")" web_sys HtmlDivElement

# use `^` to remove feature
cargo feature web_sys ^HtmlDivElement

依赖

~6MB
~102K SLoC