Struct python_packaging::licensing::LicensedComponents
source · pub struct LicensedComponents { /* private fields */ }
Expand description
A collection of licensed components.
Implementations
sourceimpl LicensedComponents
impl LicensedComponents
sourcepub fn into_components(self) -> impl Iterator<Item = LicensedComponent>
pub fn into_components(self) -> impl Iterator<Item = LicensedComponent>
Obtain an iterator over the components, consuming self.
sourcepub fn iter_components(&self) -> impl Iterator<Item = &LicensedComponent>
pub fn iter_components(&self) -> impl Iterator<Item = &LicensedComponent>
Iterate over components in this collection.
sourcepub fn add_component(&mut self, component: LicensedComponent)
pub fn add_component(&mut self, component: LicensedComponent)
Add a component to this collection.
sourcepub fn add_spdx_only_component(
&mut self,
component: LicensedComponent
) -> Result<()>
pub fn add_spdx_only_component(
&mut self,
component: LicensedComponent
) -> Result<()>
Add a component to this collection, but only if it only contains SPDX license identifiers.
sourcepub fn has_python_module(&self, name: &str) -> bool
pub fn has_python_module(&self, name: &str) -> bool
Whether a Python module exists in the collection.
sourcepub fn normalize_python_modules(&self) -> Self
pub fn normalize_python_modules(&self) -> Self
Adjusts Python modules in the components set.
Standard library modules that have identical licensing to the Python distribution are removed.
Missing top-level packages are added with an unknown license annotation.
Modules that aren’t top-level modules are removed.
sourcepub fn all_spdx_licenses(&self) -> BTreeSet<(LicenseId, Option<ExceptionId>)>
pub fn all_spdx_licenses(&self) -> BTreeSet<(LicenseId, Option<ExceptionId>)>
Obtain all SPDX license identifiers referenced by registered components.
sourcepub fn all_spdx_license_ids(&self) -> BTreeSet<LicenseId>
pub fn all_spdx_license_ids(&self) -> BTreeSet<LicenseId>
Obtain all SPDX license IDs referenced by all components.
Unlike Self::all_spdx_licenses(), this returns just the LicenseId, without exceptions.
sourcepub fn all_spdx_license_names(&self, full: bool) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn all_spdx_license_names(&self, full: bool) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Obtain all SPDX license names referenced by registered components.
sourcepub fn components_by_spdx_license(
&self
) -> BTreeMap<(LicenseId, Option<ExceptionId>), BTreeSet<&LicensedComponent>>
pub fn components_by_spdx_license(
&self
) -> BTreeMap<(LicenseId, Option<ExceptionId>), BTreeSet<&LicensedComponent>>
Obtain a mapping of all SPDX licenses to components having them.
sourcepub fn license_spdx_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
pub fn license_spdx_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
Obtain all components with valid SPDX license expressions.
sourcepub fn license_missing_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
pub fn license_missing_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
Obtain components that are missing license annotations.
sourcepub fn license_public_domain_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
pub fn license_public_domain_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
Obtain components that are licensed to the public domain.
sourcepub fn license_unknown_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
pub fn license_unknown_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
Obtain components that have unknown licensing.
There is a value for the license but that license is not recognized by us.
sourcepub fn license_copyleft_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
pub fn license_copyleft_components(
&self
) -> impl Iterator<Item = &LicensedComponent>
Components that have copyleft licenses.
There may be false negatives if the component doesn’t have fully SPDX parsed licenses.
sourcepub fn license_summary(&self) -> String
pub fn license_summary(&self) -> String
Generate a text summary of licesning info.
sourcepub fn interesting_report(&self) -> Option<String>
pub fn interesting_report(&self) -> Option<String>
Generate a text report of noteworthy licensing info.
This essentially emits license quirks that may warrant user attention.
sourcepub fn spdx_license_breakdown(&self) -> String
pub fn spdx_license_breakdown(&self) -> String
Generate a summary of SPDX licenses in all components.
Trait Implementations
sourceimpl Clone for LicensedComponents
impl Clone for LicensedComponents
sourcefn clone(&self) -> LicensedComponents
fn clone(&self) -> LicensedComponents
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more