pub struct ComponentIdentifiers {
pub purl: Option<String>,
pub cpe: Vec<String>,
pub swhid: Vec<SwhidObject>,
pub swid: Option<String>,
pub format_id: String,
pub aliases: Vec<String>,
}Expand description
Component identifiers from various sources
Fields§
§purl: Option<String>Package URL (preferred identifier)
cpe: Vec<String>Common Platform Enumeration identifiers
swhid: Vec<SwhidObject>Software Heritage persistent identifiers (SWHIDs).
Multiple values supported because a component may be expressible by
several SWHID kinds (e.g., one cnt per archive entry plus a dir
for the unpacked tree). CRA prEN 40000-1-3 [PRE-7-RQ-07] accepts
SWHIDs as one of three named identifier types.
Stored as structured SwhidObject for downstream consumers; on the
wire (JSON), each element serialises as a plain string to match the
CycloneDX / SPDX 3.0 swhid array shape.
swid: Option<String>Software Identification tag
format_id: StringOriginal format-specific identifier
aliases: Vec<String>Known aliases for this component
Implementations§
Source§impl ComponentIdentifiers
impl ComponentIdentifiers
Sourcepub fn canonical_id(&self) -> CanonicalId
pub fn canonical_id(&self) -> CanonicalId
Get the best available canonical ID (without component context)
For better stability, prefer canonical_id_with_context() which can
generate synthetic IDs from component metadata.
Sourcepub fn canonical_id_with_context(
&self,
name: &str,
version: Option<&str>,
group: Option<&str>,
) -> CanonicalIdResult
pub fn canonical_id_with_context( &self, name: &str, version: Option<&str>, group: Option<&str>, ) -> CanonicalIdResult
Get the best available canonical ID with component context for stable fallback
This method uses a tiered fallback strategy:
- PURL (most reliable)
- CPE
- SWHID (content-addressed, CRA prEN 40000-1-3 named)
- SWID
- Synthetic (group:name@version) - stable across regenerations
- Format-specific ID (least stable)
Returns both the ID and any warnings about stability.
Sourcepub fn has_stable_id(&self) -> bool
pub fn has_stable_id(&self) -> bool
Check if this component has any stable identifiers
Sourcepub fn id_reliability(&self) -> IdReliability
pub fn id_reliability(&self) -> IdReliability
Get the reliability level of available identifiers
Sourcepub fn has_cra_identifier(&self) -> bool
pub fn has_cra_identifier(&self) -> bool
Returns true if this component has any of the CRA-named identifier
types (PURL, CPE, SWHID, or SWID), satisfying CRA Annex I Part II
identifier-traceability and prEN 40000-1-3 [PRE-7-RQ-07].
Trait Implementations§
Source§impl Clone for ComponentIdentifiers
impl Clone for ComponentIdentifiers
Source§fn clone(&self) -> ComponentIdentifiers
fn clone(&self) -> ComponentIdentifiers
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComponentIdentifiers
impl Debug for ComponentIdentifiers
Source§impl Default for ComponentIdentifiers
impl Default for ComponentIdentifiers
Source§fn default() -> ComponentIdentifiers
fn default() -> ComponentIdentifiers
Source§impl<'de> Deserialize<'de> for ComponentIdentifiers
impl<'de> Deserialize<'de> for ComponentIdentifiers
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ComponentIdentifiers
impl RefUnwindSafe for ComponentIdentifiers
impl Send for ComponentIdentifiers
impl Sync for ComponentIdentifiers
impl Unpin for ComponentIdentifiers
impl UnsafeUnpin for ComponentIdentifiers
impl UnwindSafe for ComponentIdentifiers
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more