Skip to main content

weavatrix_clone/
lib.rs

1#![forbid(unsafe_code)]
2#![warn(clippy::all, clippy::pedantic)]
3
4mod accuracy;
5#[cfg(feature = "scan")]
6mod block;
7mod canonical;
8mod cluster;
9mod config;
10mod detector;
11mod error;
12mod fast_hash;
13mod fingerprint;
14#[cfg(feature = "scan")]
15mod fragment;
16mod index;
17mod model;
18pub mod output;
19#[cfg(feature = "scan")]
20mod repository;
21mod token;
22mod verify;
23
24pub use accuracy::{AccuracyCounts, AccuracyGate, AccuracyReport, OracleLocation, OraclePair};
25pub use config::CloneConfig;
26pub use detector::CloneDetector;
27pub use error::{CloneError, Result};
28pub use model::{
29    CloneEvidence, CloneFamily, CloneKind, CloneLocation, ClonePair, CloneReport, CloneStatistics,
30    DetectionMode, Language, Similarity, SourceFragment, SourceSpan,
31};
32#[cfg(feature = "scan")]
33pub use repository::{RepositoryCloneDetector, RepositoryOptions};
34
35/// Optional Type-4 candidate source implemented by a future vector package.
36///
37/// The deterministic Type-1/2/3 detector never calls this trait. Higher layers
38/// may use it to propose semantic candidates and then apply their own evidence
39/// and confidence policy.
40pub trait SemanticCandidateProvider {
41    /// Returns candidate fragment identifiers for one fragment.
42    ///
43    /// # Errors
44    ///
45    /// Provider failures remain explicit and never change deterministic clone
46    /// output.
47    fn candidates(&self, fragment: &SourceFragment, limit: usize) -> Result<Vec<String>>;
48}