7 unstable releases (3 breaking)
Uses new Rust 2024
| new 0.4.2 | Feb 24, 2026 |
|---|---|
| 0.4.1 | Feb 24, 2026 |
| 0.3.0 | Jan 25, 2026 |
| 0.2.0 | Jan 24, 2026 |
| 0.1.1 | Jan 23, 2026 |
#201 in Cargo plugins
Used in 3 crates
155KB
3K
SLoC
battery-pack: Framework for building and using battery packs.
Battery packs are curated collections of crates that work well together.
The CLI (cargo bp) syncs real dependencies into your Cargo.toml,
and this library provides build-time validation to detect drift.
For Battery Pack Authors
Your lib.rs should look like this:
const SELF_MANIFEST: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/Cargo.toml"));
pub fn validate() {
battery_pack::validate(SELF_MANIFEST);
}
For Battery Pack Users
Your build.rs should call validate:
fn main() {
cli_battery_pack::validate();
}
battery-pack
The battery-pack crate provides two things:
- The
cargo bpCLI for working with battery packs - Common infrastructure for authoring battery packs
What's a Battery Pack?
A battery pack bundles everything you need to get started in an area: curated crates, documentation, examples, and templates.
Think of it like an addition to the standard library targeting a particular use case, like building a CLI tool or web server.
Installing the CLI
cargo install battery-pack
# or
cargo binstall battery-pack
Using the CLI
# Create a new project from a battery pack template
cargo bp new cli
# Add a battery pack to your project
cargo bp add cli
# Show info about a battery pack
cargo bp show cli
Authoring Battery Packs
The battery-pack crate is also a battery pack itself.
# Create a new project from a battery pack template
cargo bp new battery-pack
Dependencies
~45–68MB
~1M SLoC