Struct tugger_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_spdx(name: &str, spdx_expression: &str) -> Result<Self>
pub fn new_spdx(name: &str, spdx_expression: &str) -> Result<Self>
Construct a new instance from an SPDX expression.
sourcepub fn new_public_domain(name: &str) -> Self
pub fn new_public_domain(name: &str) -> Self
Construct a new instance with a license in the public domain.
sourcepub fn new_unknown(name: &str, terms: Vec<String>) -> Self
pub fn new_unknown(name: &str, terms: Vec<String>) -> Self
Construct a new instance with an unknown license.
sourcepub fn flavor(&self) -> &ComponentFlavor
pub fn flavor(&self) -> &ComponentFlavor
The type of this component.
sourcepub fn set_flavor(&mut self, flavor: ComponentFlavor)
pub fn set_flavor(&mut self, flavor: ComponentFlavor)
Set the flavor 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 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.
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 PartialEq<LicensedComponent> for LicensedComponent
impl PartialEq<LicensedComponent> for LicensedComponent
sourcefn eq(&self, other: &LicensedComponent) -> bool
fn eq(&self, other: &LicensedComponent) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &LicensedComponent) -> bool
fn ne(&self, other: &LicensedComponent) -> bool
This method tests for !=
.
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
impl StructuralPartialEq 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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more