Struct LicensedComponents

Source
pub struct LicensedComponents { /* private fields */ }
Expand description

A collection of licensed components.

Implementations§

Source§

impl LicensedComponents

Source

pub fn into_components(self) -> impl Iterator<Item = LicensedComponent>

Obtain an iterator over the components, consuming self.

Source

pub fn iter_components(&self) -> impl Iterator<Item = &LicensedComponent>

Iterate over components in this collection.

Source

pub fn add_component(&mut self, component: LicensedComponent)

Add a component to this collection.

Source

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.

Source

pub fn has_python_module(&self, name: &str) -> bool

Whether a Python module exists in the collection.

Source

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.

Source

pub fn all_spdx_licenses(&self) -> BTreeSet<(LicenseId, Option<ExceptionId>)>

Obtain all SPDX license identifiers referenced by registered components.

Source

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.

Source

pub fn all_spdx_license_names(&self, full: bool) -> Vec<String>

Obtain all SPDX license names referenced by registered components.

Source

pub fn components_by_spdx_license( &self, ) -> BTreeMap<(LicenseId, Option<ExceptionId>), BTreeSet<&LicensedComponent>>

Obtain a mapping of all SPDX licenses to components having them.

Source

pub fn license_spdx_components( &self, ) -> impl Iterator<Item = &LicensedComponent>

Obtain all components with valid SPDX license expressions.

Source

pub fn license_missing_components( &self, ) -> impl Iterator<Item = &LicensedComponent>

Obtain components that are missing license annotations.

Source

pub fn license_public_domain_components( &self, ) -> impl Iterator<Item = &LicensedComponent>

Obtain components that are licensed to the public domain.

Source

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.

Source

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.

Source

pub fn license_summary(&self) -> String

Generate a text summary of licesning info.

Source

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.

Source

pub fn spdx_license_breakdown(&self) -> String

Generate a summary of SPDX licenses in all components.

Trait Implementations§

Source§

impl Clone for LicensedComponents

Source§

fn clone(&self) -> LicensedComponents

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LicensedComponents

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LicensedComponents

Source§

fn default() -> LicensedComponents

Returns the “default value” for a type. Read more
Source§

impl PartialEq for LicensedComponents

Source§

fn eq(&self, other: &LicensedComponents) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for LicensedComponents

Source§

impl StructuralPartialEq for LicensedComponents

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.