pub struct Diff {
pub added: Vec<Component>,
pub removed: Vec<Component>,
pub changed: Vec<ComponentChange>,
pub edge_diffs: Vec<EdgeDiff>,
pub metadata_changed: bool,
pub old_total: usize,
pub new_total: usize,
pub unchanged: usize,
pub component_names: BTreeMap<ComponentId, String>,
}Expand description
The result of comparing two SBOMs.
Contains lists of added, removed, and changed components, as well as dependency edge changes.
Fields§
§added: Vec<Component>Components present in the new SBOM but not the old.
removed: Vec<Component>Components present in the old SBOM but not the new.
changed: Vec<ComponentChange>Components present in both with field-level changes.
edge_diffs: Vec<EdgeDiff>Dependency edge changes between components.
metadata_changed: boolWhether document metadata differs (usually ignored).
old_total: usizeTotal number of components in the old SBOM.
new_total: usizeTotal number of components in the new SBOM.
unchanged: usizeNumber of components present in both SBOMs with no changes.
component_names: BTreeMap<ComponentId, String>Human-readable display names for component IDs that appear in edge diffs.
Maps hash-based IDs (h:...) to name@version or name so that edge
diff output is readable without cross-referencing the full component list.
Implementations§
Source§impl Diff
impl Diff
Sourcepub fn display_name<'a>(&'a self, id: &'a ComponentId) -> &'a str
pub fn display_name<'a>(&'a self, id: &'a ComponentId) -> &'a str
Returns a human-readable display name for a component ID.
Looks up the ID in component_names; falls back to the raw ID string.
Sourcepub fn ecosystem_breakdown(&self) -> BTreeMap<String, EcosystemCounts>
pub fn ecosystem_breakdown(&self) -> BTreeMap<String, EcosystemCounts>
Groups added/removed/changed counts by package ecosystem.
Components without an ecosystem are grouped under "unknown".
Sourcepub fn group_by_ecosystem(&self) -> GroupedDiff
pub fn group_by_ecosystem(&self) -> GroupedDiff
Groups the full diff by ecosystem, returning per-ecosystem slices.
Components without an ecosystem are grouped under "unknown".
Sourcepub fn into_group_by_ecosystem(self) -> GroupedDiff
pub fn into_group_by_ecosystem(self) -> GroupedDiff
Consuming variant of group_by_ecosystem
that moves components instead of cloning them.