pub struct Component {
pub name: String,
pub version: Option<String>,
pub component_type: ComponentType,
pub purl: Option<String>,
pub description: Option<String>,
pub author: Option<String>,
pub license: Option<String>,
pub repository: Option<String>,
pub hash_sha256: Option<String>,
}Expand description
A component in the SBOM.
Fields§
§name: StringComponent name
version: Option<String>Component version
component_type: ComponentTypeComponent type
purl: Option<String>Package URL (purl)
description: Option<String>Description
Author or publisher
license: Option<String>License identifier
repository: Option<String>Repository URL
hash_sha256: Option<String>SHA-256 hash of the component
Implementations§
Source§impl Component
impl Component
Sourcepub fn new(name: impl Into<String>, component_type: ComponentType) -> Self
pub fn new(name: impl Into<String>, component_type: ComponentType) -> Self
Create a new component.
Sourcepub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
Set the version.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the description.
Set the author.
Sourcepub fn with_license(self, license: impl Into<String>) -> Self
pub fn with_license(self, license: impl Into<String>) -> Self
Set the license.
Sourcepub fn with_repository(self, repo: impl Into<String>) -> Self
pub fn with_repository(self, repo: impl Into<String>) -> Self
Set the repository URL.
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin 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
Mutably borrows from an owned value. Read more