Struct python_packaging::licensing::LicensedComponent
source · [−]pub struct LicensedComponent { /* private fields */ }
Expand description
Represents a software component with licensing information.
Implementations
sourceimpl 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>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn license_texts(&self) -> &Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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>ⓘ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.
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
sourceimpl Clone for LicensedComponent
impl Clone for LicensedComponent
sourcefn clone(&self) -> LicensedComponent
fn clone(&self) -> LicensedComponent
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for LicensedComponent
impl Debug for LicensedComponent
sourceimpl Ord for LicensedComponent
impl Ord for LicensedComponent
sourceimpl PartialOrd<LicensedComponent> for LicensedComponent
impl PartialOrd<LicensedComponent> for LicensedComponent
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl TryInto<LicensedComponent> for PackageLicenseInfo
impl TryInto<LicensedComponent> for PackageLicenseInfo
impl Eq for LicensedComponent
Auto Trait Implementations
impl RefUnwindSafe for LicensedComponent
impl Send for LicensedComponent
impl Sync for LicensedComponent
impl Unpin for LicensedComponent
impl UnwindSafe for LicensedComponent
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more