pub struct LicenseDetectionEngine { /* private fields */ }Expand description
License detection engine that orchestrates the detection pipeline.
The engine loads license rules and builds an index for efficient matching. It supports multiple matching strategies (hash, SPDX-LID, Aho-Corasick, sequence) and combines their results into final license detections.
Implementations§
Source§impl LicenseDetectionEngine
impl LicenseDetectionEngine
Sourcepub fn from_embedded() -> Result<Self>
pub fn from_embedded() -> Result<Self>
Create a new license detection engine from the embedded license index.
Convenience method that uses the default Provenant cache root and does not force a reindex.
Sourcepub fn from_embedded_with_cache(
cache_config: &LicenseCacheConfig,
) -> Result<Self>
pub fn from_embedded_with_cache( cache_config: &LicenseCacheConfig, ) -> Result<Self>
Create a new license detection engine from the embedded license index.
This method loads the build-time embedded license artifact and constructs the runtime license index. This eliminates the runtime dependency on the ScanCode rules directory.
If a valid cache exists (matching fingerprint), the index is loaded from the rkyv cache file instead of being rebuilt from scratch.
§Arguments
cache_config- Cache configuration (directory and reindex flag)
§Returns
A Result containing the engine or an error
Sourcepub fn from_directory(rules_path: &Path) -> Result<Self>
pub fn from_directory(rules_path: &Path) -> Result<Self>
Create a new license detection engine from a license dataset root.
Convenience method that uses the default Provenant cache root and does not force a reindex.
Sourcepub fn from_directory_with_cache(
rules_path: &Path,
cache_config: &LicenseCacheConfig,
) -> Result<Self>
pub fn from_directory_with_cache( rules_path: &Path, cache_config: &LicenseCacheConfig, ) -> Result<Self>
Create a new license detection engine from a directory of license rules.
If a valid cache exists (matching fingerprint of the dataset), the index is loaded from the rkyv cache file instead of being rebuilt from scratch.
§Arguments
rules_path- Path to dataset root containing rules/ and licenses/cache_config- Cache configuration (directory and reindex flag)
§Returns
A Result containing the engine or an error
pub fn embedded_spdx_license_list_version() -> Result<String>
pub fn detect_with_kind( &self, text: &str, unknown_licenses: bool, binary_derived: bool, ) -> Result<Vec<LicenseDetection>>
pub fn detect_with_kind_with_score( &self, text: &str, unknown_licenses: bool, binary_derived: bool, min_score: f32, ) -> Result<Vec<LicenseDetection>>
pub fn detect_with_kind_and_source( &self, text: &str, unknown_licenses: bool, binary_derived: bool, source_path: &str, ) -> Result<Vec<LicenseDetection>>
pub fn detect_with_kind_and_source_with_score( &self, text: &str, unknown_licenses: bool, binary_derived: bool, source_path: &str, min_score: f32, ) -> Result<Vec<LicenseDetection>>
Sourcepub fn index(&self) -> &LicenseIndex
pub fn index(&self) -> &LicenseIndex
Get a reference to the license index.
pub fn spdx_license_list_version(&self) -> Option<&str>
pub fn license_index_provenance(&self) -> Option<&LicenseIndexProvenance>
Trait Implementations§
Source§impl Clone for LicenseDetectionEngine
impl Clone for LicenseDetectionEngine
Source§fn clone(&self) -> LicenseDetectionEngine
fn clone(&self) -> LicenseDetectionEngine
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LicenseDetectionEngine
impl RefUnwindSafe for LicenseDetectionEngine
impl Send for LicenseDetectionEngine
impl Sync for LicenseDetectionEngine
impl Unpin for LicenseDetectionEngine
impl UnsafeUnpin for LicenseDetectionEngine
impl UnwindSafe for LicenseDetectionEngine
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<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.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.