pub struct Component {Show 24 fields
pub canonical_id: CanonicalId,
pub identifiers: ComponentIdentifiers,
pub name: String,
pub version: Option<String>,
pub semver: Option<Version>,
pub component_type: ComponentType,
pub ecosystem: Option<Ecosystem>,
pub licenses: LicenseInfo,
pub supplier: Option<Organization>,
pub hashes: Vec<Hash>,
pub external_refs: Vec<ExternalReference>,
pub vulnerabilities: Vec<VulnerabilityRef>,
pub vex_status: Option<VexStatus>,
pub content_hash: u64,
pub extensions: ComponentExtensions,
pub description: Option<String>,
pub copyright: Option<String>,
pub author: Option<String>,
pub group: Option<String>,
pub is_external: bool,
pub version_range: Option<String>,
pub staleness: Option<StalenessInfo>,
pub eol: Option<EolInfo>,
pub crypto_properties: Option<CryptoProperties>,
}Expand description
Component in the normalized SBOM
Fields§
§canonical_id: CanonicalIdCanonical identifier
identifiers: ComponentIdentifiersVarious identifiers (PURL, CPE, etc.)
name: StringComponent name
version: Option<String>Version string
semver: Option<Version>Parsed semantic version (if valid)
component_type: ComponentTypeComponent type
ecosystem: Option<Ecosystem>Package ecosystem
licenses: LicenseInfoLicense information
supplier: Option<Organization>Supplier/vendor information
hashes: Vec<Hash>Cryptographic hashes
external_refs: Vec<ExternalReference>External references
vulnerabilities: Vec<VulnerabilityRef>Known vulnerabilities
vex_status: Option<VexStatus>VEX status
content_hash: u64Content hash for quick comparison
extensions: ComponentExtensionsFormat-specific extensions
description: Option<String>Description
copyright: Option<String>Copyright text
Author information
group: Option<String>Group/namespace (e.g., Maven groupId)
is_external: boolWhether this component is external (expected from environment, not bundled)
version_range: Option<String>Package URL Version Range (vers) syntax, only valid when is_external is true
staleness: Option<StalenessInfo>Staleness information (populated by enrichment)
eol: Option<EolInfo>End-of-life information (populated by enrichment)
crypto_properties: Option<CryptoProperties>Cryptographic properties (CycloneDX 1.6+ cryptoProperties)
Implementations§
Source§impl Component
impl Component
Sourcepub fn new(name: String, format_id: String) -> Self
pub fn new(name: String, format_id: String) -> Self
Create a new component with minimal required fields
Sourcepub fn with_version(self, version: String) -> Self
pub fn with_version(self, version: String) -> Self
Set the version and try to parse as semver
Sourcepub fn with_swhid(self, swhid: String) -> Self
pub fn with_swhid(self, swhid: String) -> Self
Add a Software Heritage persistent identifier (SWHID) from a string.
Invalid SWHIDs are silently dropped (matches the parser-tolerant
behaviour of CanonicalId::from_swhid). Use with_swhid_object when
you already have a SwhidObject in hand.
Recognised by CRA prEN 40000-1-3 [PRE-7-RQ-07] as one of the three
named identifier types (alongside PURL and CPE). Multiple SWHIDs can
be attached to a single component (e.g., a dir SWHID for the
unpacked tree plus cnt SWHIDs for individual files).
Sourcepub fn with_swhid_object(self, swhid: SwhidObject) -> Self
pub fn with_swhid_object(self, swhid: SwhidObject) -> Self
Add a structured SwhidObject SWHID.
Sourcepub fn calculate_content_hash(&mut self)
pub fn calculate_content_hash(&mut self)
Calculate and update content hash
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Get display name with version
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Component
impl<'de> Deserialize<'de> for Component
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>,
Source§impl From<&Component> for ComponentRef
impl From<&Component> for ComponentRef
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin for Component
impl UnsafeUnpin for Component
impl UnwindSafe for Component
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