pub struct Options {
pub min_tokens: usize,
pub threshold: f64,
pub max_candidates: usize,
pub max_occurrences: usize,
pub exclude_packages: Vec<(String, String)>,
pub stop_packages: usize,
pub min_shared: usize,
pub idf: bool,
pub dependencies: Dependencies,
}Expand description
Parameters of the search.
§Examples
use pelicode_detect::Options;
let options = Options { threshold: 0.5, stop_packages: 0, ..Options::default() };
assert_eq!(options.max_candidates, 5);Fields§
§min_tokens: usizeFunctions with fewer tokens are not checked.
threshold: f64Minimum Jaccard similarity of fingerprint sets to report a candidate.
max_candidates: usizeCandidates reported per function.
max_occurrences: usizeOccurrences listed per candidate.
exclude_packages: Vec<(String, String)>Packages whose functions are never reported, as (ecosystem, name).
stop_packages: usizeHashes found in at least this many packages are ignored (0 disables).
Needs the statistics of Database::refresh_hash_stats.
Minimum number of shared (non-common) fingerprints for a similar match. Without it, a function whose fingerprints are almost all common could reach a high similarity through one or two remaining ones.
idf: boolWeight fingerprints by inverse document frequency, ln(1 + N / df),
where N is the number of packages and df those containing the fingerprint.
dependencies: DependenciesPackages the checked code depends on (see dependencies): candidates
found only in them are not reported, and their occurrences are left out
of the other candidates.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin for Options
impl UnwindSafe for Options
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<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 more