#[non_exhaustive]pub enum LicenseSource {
RegistryDeclaredSpdx,
FetchedDeclaredSpdx,
DetectedSpdx,
PomFreeText,
}Expand description
How this ecosystem’s license strings are sourced.
Drives three ecosystem-specific license behaviors that used to be re-derived
independently at each consumer via a non-exhaustive matches!/== on
EcosystemId instead of the sealed Ecosystem trait every other per-ecosystem
capability goes through (issue #688): hover’s “(detected)” qualifier, which only
applies to Self::DetectedSpdx; whether
crate::licenses::resolve_license_entries must normalize free text to SPDX
identifiers before hover displays it or a crate::licenses::LicensePolicy
evaluates it, which only applies to Self::PomFreeText; and, via
Self::requires_dedicated_fetch (issue #697), whether
Ecosystem::fetch_license is a dedicated async fetch or a no-op because the
license already arrived in the hot-path registry response.
§Examples
use deps_core::LicenseSource;
assert_eq!(LicenseSource::default(), LicenseSource::RegistryDeclaredSpdx);
assert_ne!(LicenseSource::PomFreeText, LicenseSource::DetectedSpdx);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RegistryDeclaredSpdx
Author-declared SPDX identifier(s) already present in the hot-path registry
response — the default for every ecosystem that doesn’t override
Ecosystem::license_source, and the only variant for which
Self::requires_dedicated_fetch is false.
FetchedDeclaredSpdx
Author-declared SPDX identifier(s) that require a dedicated fetch separate from the hot-path registry response: JSR’s package-metadata endpoint (Deno).
DetectedSpdx
A detector’s best-effort guess, not an author declaration, that requires a
dedicated fetch: pub.dev’s /score endpoint (Dart) and GitHub’s
license.spdx_id (Swift) are both driven by a license-detection heuristic run
against repository content, rather than metadata the package author explicitly
declared to a registry.
PomFreeText
Maven POM <licenses><license><name> free text (Gradle), fetched via a
dedicated request — never an SPDX identifier, so it must be normalized via
crate::licenses::resolve_license_entries before display or policy evaluation.
Implementations§
Source§impl LicenseSource
impl LicenseSource
Sourcepub const fn requires_dedicated_fetch(self) -> bool
pub const fn requires_dedicated_fetch(self) -> bool
Whether this source requires Ecosystem::fetch_license’s dedicated async
fetch, as opposed to arriving for free in the hot-path registry response.
This is the single answer to “is this a tier-3 license ecosystem” (issue #697):
capability and shape can no longer disagree, because both come from the same
Ecosystem::license_source call.
§Examples
use deps_core::LicenseSource;
assert!(!LicenseSource::RegistryDeclaredSpdx.requires_dedicated_fetch());
assert!(LicenseSource::FetchedDeclaredSpdx.requires_dedicated_fetch());
assert!(LicenseSource::DetectedSpdx.requires_dedicated_fetch());
assert!(LicenseSource::PomFreeText.requires_dedicated_fetch());Trait Implementations§
Source§impl Clone for LicenseSource
impl Clone for LicenseSource
impl Copy for LicenseSource
Source§impl Debug for LicenseSource
impl Debug for LicenseSource
Source§impl Default for LicenseSource
impl Default for LicenseSource
impl Eq for LicenseSource
Source§impl PartialEq for LicenseSource
impl PartialEq for LicenseSource
impl StructuralPartialEq for LicenseSource
Auto Trait Implementations§
impl Freeze for LicenseSource
impl RefUnwindSafe for LicenseSource
impl Send for LicenseSource
impl Sync for LicenseSource
impl Unpin for LicenseSource
impl UnsafeUnpin for LicenseSource
impl UnwindSafe for LicenseSource
Blanket Implementations§
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§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.