pub struct LicensedComponent { /* private fields */ }
Expand description
Represents a software component with licensing information.
Implementations§
Source§impl LicensedComponent
impl LicensedComponent
Sourcepub fn new(flavor: ComponentFlavor, license: LicenseFlavor) -> Self
pub fn new(flavor: ComponentFlavor, license: LicenseFlavor) -> Self
Construct a new instance from parameters.
Sourcepub fn new_spdx(flavor: ComponentFlavor, spdx_expression: &str) -> Result<Self>
pub fn new_spdx(flavor: ComponentFlavor, spdx_expression: &str) -> Result<Self>
Construct a new instance from an SPDX expression.
Sourcepub fn flavor(&self) -> &ComponentFlavor
pub fn flavor(&self) -> &ComponentFlavor
The type of this component.
Sourcepub fn license(&self) -> &LicenseFlavor
pub fn license(&self) -> &LicenseFlavor
Obtain the flavor of license for this component.
Sourcepub fn spdx_expression(&self) -> Option<&Expression>
pub fn spdx_expression(&self) -> Option<&Expression>
Obtain the SPDX expression for this component’s license.
Sourcepub fn is_simple_spdx_expression(&self) -> bool
pub fn is_simple_spdx_expression(&self) -> bool
Whether the SPDX expression is simple.
Simple is defined as having at most a single license.
Sourcepub fn source_location(&self) -> &SourceLocation
pub fn source_location(&self) -> &SourceLocation
Obtain the location where the source of this component can be obtained.
Sourcepub fn set_source_location(&mut self, location: SourceLocation)
pub fn set_source_location(&mut self, location: SourceLocation)
Define where source code for this component can be obtained from.
Sourcepub fn set_homepage(&mut self, value: impl ToString)
pub fn set_homepage(&mut self, value: impl ToString)
Set the homepage of this component.
Obtain the annotated authors of this component.
Define an author of this component.
Sourcepub fn license_texts(&self) -> &Vec<String>
pub fn license_texts(&self) -> &Vec<String>
Obtain the explicitly set license texts for this component.
Sourcepub fn add_license_text(&mut self, text: impl ToString)
pub fn add_license_text(&mut self, text: impl ToString)
Define the license text for this component.
Sourcepub fn all_spdx_licenses(&self) -> BTreeSet<(LicenseId, Option<ExceptionId>)>
pub fn all_spdx_licenses(&self) -> BTreeSet<(LicenseId, Option<ExceptionId>)>
Obtain all SPDX licenses referenced by this component.
The first element of the returned tuple is the license identifier. The 2nd is an optional exclusion identifier.
Sourcepub fn all_spdx_license_names(&self, full: bool) -> Vec<String>
pub fn all_spdx_license_names(&self, full: bool) -> Vec<String>
Obtain all SPDX license names.
Sourcepub fn all_spdx_license_ids(&self) -> BTreeSet<LicenseId>
pub fn all_spdx_license_ids(&self) -> BTreeSet<LicenseId>
Obtain all the distinct LicenseId in this component.
Unlike Self::all_spdx_licenses(), this returns just the license IDs without exceptions.
Sourcepub fn all_spdx_exception_ids(&self) -> BTreeSet<ExceptionId>
pub fn all_spdx_exception_ids(&self) -> BTreeSet<ExceptionId>
Obtain all the ExceptionId present in this component.
Sourcepub fn has_copyleft(&self) -> bool
pub fn has_copyleft(&self) -> bool
Whether the component has any copyleft licenses.
Sourcepub fn is_always_copyleft(&self) -> bool
pub fn is_always_copyleft(&self) -> bool
Whether all licenses are copyleft.
Sourcepub fn licensing_summary(&self) -> String
pub fn licensing_summary(&self) -> String
Obtain a textual licensing summary of this component.
Trait Implementations§
Source§impl Clone for LicensedComponent
impl Clone for LicensedComponent
Source§fn clone(&self) -> LicensedComponent
fn clone(&self) -> LicensedComponent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for LicensedComponent
impl Debug for LicensedComponent
Source§impl Ord for LicensedComponent
impl Ord for LicensedComponent
Source§impl PartialEq for LicensedComponent
impl PartialEq for LicensedComponent
Source§impl PartialOrd for LicensedComponent
impl PartialOrd for LicensedComponent
impl Eq for LicensedComponent
Auto Trait Implementations§
impl Freeze for LicensedComponent
impl RefUnwindSafe for LicensedComponent
impl Send for LicensedComponent
impl Sync for LicensedComponent
impl Unpin for LicensedComponent
impl UnwindSafe for LicensedComponent
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> 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