pub struct BatteryPackSpec {
pub name: String,
pub version: String,
pub description: String,
pub repository: Option<String>,
pub keywords: Vec<String>,
pub crates: BTreeMap<String, CrateSpec>,
pub features: BTreeMap<String, BTreeSet<String>>,
pub hidden: BTreeSet<String>,
pub templates: BTreeMap<String, TemplateSpec>,
}Expand description
Parsed battery pack specification.
This is the core data model extracted from a battery pack’s Cargo.toml. All curated crates, features, hidden deps, and templates are represented here.
Fields§
§name: StringCrate name (e.g., cli-battery-pack).
version: StringVersion string.
description: StringPackage description.
repository: Option<String>Repository URL.
keywords: Vec<String>Package keywords.
crates: BTreeMap<String, CrateSpec>All curated crates, keyed by crate name.
features: BTreeMap<String, BTreeSet<String>>Named features from [features], mapping feature name to crate names.
Hidden dependency patterns (may include globs).
templates: BTreeMap<String, TemplateSpec>Templates registered in metadata.
Implementations§
Source§impl BatteryPackSpec
impl BatteryPackSpec
Sourcepub fn validate(&self) -> Result<(), Error>
pub fn validate(&self) -> Result<(), Error>
Validate that this looks like a valid battery pack.
Sourcepub fn validate_spec(&self) -> ValidationReport
pub fn validate_spec(&self) -> ValidationReport
Comprehensive spec validation — collects all issues rather than failing on the first one. Checks data-only rules from the spec.
Sourcepub fn resolve_crates(
&self,
active_features: &[&str],
) -> BTreeMap<String, CrateSpec>
pub fn resolve_crates( &self, active_features: &[&str], ) -> BTreeMap<String, CrateSpec>
Resolve which crates should be installed for the given active features.
With no features specified (empty slice), returns the default set:
crates from the default feature, or all non-optional crates if
no default feature exists.
Features are additive — each named feature adds its crates on top.
Sourcepub fn resolve_all(&self) -> BTreeMap<String, CrateSpec>
pub fn resolve_all(&self) -> BTreeMap<String, CrateSpec>
Resolve all crates regardless of features or optional status.
Sourcepub fn resolve_all_visible(&self) -> BTreeMap<String, CrateSpec>
pub fn resolve_all_visible(&self) -> BTreeMap<String, CrateSpec>
Resolve all visible (non-hidden) crates regardless of features or optional status.
Sourcepub fn resolve_for_features(
&self,
active_features: &BTreeSet<String>,
) -> BTreeMap<String, CrateSpec>
pub fn resolve_for_features( &self, active_features: &BTreeSet<String>, ) -> BTreeMap<String, CrateSpec>
Resolve crates for a set of active features, handling the “all” sentinel.
If active_features contains "all", returns all visible crates.
Otherwise delegates to resolve_crates.
Check whether a crate name matches the hidden patterns.
Sourcepub fn visible_crates(&self) -> BTreeMap<&str, &CrateSpec>
pub fn visible_crates(&self) -> BTreeMap<&str, &CrateSpec>
Return all non-hidden crates.
Sourcepub fn all_crates_with_grouping(
&self,
) -> Vec<(String, String, &CrateSpec, bool)>
pub fn all_crates_with_grouping( &self, ) -> Vec<(String, String, &CrateSpec, bool)>
Return all visible (non-hidden) crates grouped by feature, with a flag indicating whether each crate is in the default set.
Returns Vec<(group_name, crate_name, &CrateSpec, is_default)>.
Crates not in any feature are grouped under "default".
Sourcepub fn has_meaningful_choices(&self) -> bool
pub fn has_meaningful_choices(&self) -> bool
Returns true if this battery pack has meaningful choices for the user (more than 3 crates or has named features beyond default).
Trait Implementations§
Source§impl Clone for BatteryPackSpec
impl Clone for BatteryPackSpec
Source§fn clone(&self) -> BatteryPackSpec
fn clone(&self) -> BatteryPackSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more