pub struct LoadedLicense {Show 29 fields
pub key: String,
pub short_name: Option<String>,
pub name: String,
pub language: Option<String>,
pub spdx_license_key: Option<String>,
pub other_spdx_license_keys: Vec<String>,
pub category: Option<String>,
pub owner: Option<String>,
pub homepage_url: Option<String>,
pub text: String,
pub reference_urls: Vec<String>,
pub osi_license_key: Option<String>,
pub text_urls: Vec<String>,
pub osi_url: Option<String>,
pub faq_url: Option<String>,
pub other_urls: Vec<String>,
pub notes: Option<String>,
pub is_deprecated: bool,
pub is_exception: bool,
pub is_unknown: bool,
pub is_generic: bool,
pub replaced_by: Vec<String>,
pub minimum_coverage: Option<u8>,
pub standard_notice: Option<String>,
pub ignorable_copyrights: Option<Vec<String>>,
pub ignorable_holders: Option<Vec<String>>,
pub ignorable_authors: Option<Vec<String>>,
pub ignorable_urls: Option<Vec<String>>,
pub ignorable_emails: Option<Vec<String>>,
}Expand description
Loader-stage representation of a license.
This struct contains parsed and normalized data from a .LICENSE file.
It is serialized at build time and deserialized at runtime, then converted
to a runtime License during the build stage.
Fields§
§key: String§short_name: Option<String>§name: String§language: Option<String>§spdx_license_key: Option<String>§other_spdx_license_keys: Vec<String>§category: Option<String>§owner: Option<String>§homepage_url: Option<String>§text: String§reference_urls: Vec<String>§osi_license_key: Option<String>§text_urls: Vec<String>§osi_url: Option<String>§faq_url: Option<String>§other_urls: Vec<String>§notes: Option<String>§is_deprecated: bool§is_exception: bool§is_unknown: bool§is_generic: bool§replaced_by: Vec<String>§minimum_coverage: Option<u8>§standard_notice: Option<String>§ignorable_copyrights: Option<Vec<String>>§ignorable_holders: Option<Vec<String>>§ignorable_urls: Option<Vec<String>>§ignorable_emails: Option<Vec<String>>Implementations§
Source§impl LoadedLicense
Loader-stage normalization functions for license data.
impl LoadedLicense
Loader-stage normalization functions for license data.
Sourcepub fn derive_key(path: &Path) -> Result<String, LicenseKeyError>
pub fn derive_key(path: &Path) -> Result<String, LicenseKeyError>
Derive key from filename.
Returns the file stem (filename without extension) as the key.
This should match the key field in the frontmatter.
Sourcepub fn validate_key_match(
filename_key: &str,
frontmatter_key: Option<&str>,
) -> Result<(), LicenseKeyError>
pub fn validate_key_match( filename_key: &str, frontmatter_key: Option<&str>, ) -> Result<(), LicenseKeyError>
Validate that the frontmatter key matches the filename key.
Sourcepub fn derive_name(
name: Option<&str>,
short_name: Option<&str>,
key: &str,
) -> String
pub fn derive_name( name: Option<&str>, short_name: Option<&str>, key: &str, ) -> String
Derive name using the fallback chain.
Priority order:
namefieldshort_namefieldkeyas fallback
Sourcepub fn merge_reference_urls(
text_urls: Option<&[String]>,
other_urls: Option<&[String]>,
osi_url: Option<&str>,
faq_url: Option<&str>,
homepage_url: Option<&str>,
) -> Vec<String>
pub fn merge_reference_urls( text_urls: Option<&[String]>, other_urls: Option<&[String]>, osi_url: Option<&str>, faq_url: Option<&str>, homepage_url: Option<&str>, ) -> Vec<String>
Merge reference URLs from multiple source fields.
Collects URLs in this order:
- text_urls
- other_urls
- osi_url
- faq_url
- homepage_url
Sourcepub fn normalize_optional_string(s: Option<&str>) -> Option<String>
pub fn normalize_optional_string(s: Option<&str>) -> Option<String>
Normalize optional string field.
Returns None for empty strings, Some(trimmed) otherwise.
Sourcepub fn normalize_optional_list(list: Option<&[String]>) -> Option<Vec<String>>
pub fn normalize_optional_list(list: Option<&[String]>) -> Option<Vec<String>>
Normalize optional string list.
Returns None for empty lists, Some(list) with trimmed strings otherwise.
Sourcepub fn validate_text_content(
text: &str,
is_deprecated: bool,
is_unknown: bool,
is_generic: bool,
) -> Result<(), LicenseTextError>
pub fn validate_text_content( text: &str, is_deprecated: bool, is_unknown: bool, is_generic: bool, ) -> Result<(), LicenseTextError>
Validate that a non-deprecated, non-unknown, non-generic license has text content.
Trait Implementations§
Source§impl Clone for LoadedLicense
impl Clone for LoadedLicense
Source§fn clone(&self) -> LoadedLicense
fn clone(&self) -> LoadedLicense
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LoadedLicense
impl Debug for LoadedLicense
Source§impl<'de> Deserialize<'de> for LoadedLicense
impl<'de> Deserialize<'de> for LoadedLicense
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for LoadedLicense
impl PartialEq for LoadedLicense
Source§impl Serialize for LoadedLicense
impl Serialize for LoadedLicense
impl Eq for LoadedLicense
impl StructuralPartialEq for LoadedLicense
Auto Trait Implementations§
impl Freeze for LoadedLicense
impl RefUnwindSafe for LoadedLicense
impl Send for LoadedLicense
impl Sync for LoadedLicense
impl Unpin for LoadedLicense
impl UnsafeUnpin for LoadedLicense
impl UnwindSafe for LoadedLicense
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.