pub struct PreparedSource {
pub id: String,
pub format: String,
pub hashes: Vec<u64>,
pub spans: Vec<(Location, Location)>,
pub raw_hashes: Vec<u64>,
pub functions: Vec<FunctionSig>,
}Expand description
A file ready for detection: pre-hashed, pre-filtered.
Produced either from SourceFile.tokens (backward compat) or directly from
tokenize_to_detection output (fast path used by orchestrate.rs).
Fields§
§id: String§format: String§hashes: Vec<u64>§spans: Vec<(Location, Location)>§raw_hashes: Vec<u64>Un-normalized token hashes, parallel to hashes. Empty unless a
normalization option rewrote at least one token of this source; then
it is used to classify clones as exact or renamed (issue #998).
functions: Vec<FunctionSig>Function signatures for similarity scoring (issue #999). Empty unless
--similarity is set and the format is JavaScript/TypeScript.
Implementations§
Source§impl PreparedSource
impl PreparedSource
Sourcepub fn from_detection_tokens(
id: String,
format: String,
tokens: &[DetectionToken],
) -> Self
pub fn from_detection_tokens( id: String, format: String, tokens: &[DetectionToken], ) -> Self
Build from a DetectionToken slice — the fast path.
Trait Implementations§
Source§impl Clone for PreparedSource
impl Clone for PreparedSource
Source§fn clone(&self) -> PreparedSource
fn clone(&self) -> PreparedSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PreparedSource
impl RefUnwindSafe for PreparedSource
impl Send for PreparedSource
impl Sync for PreparedSource
impl Unpin for PreparedSource
impl UnsafeUnpin for PreparedSource
impl UnwindSafe for PreparedSource
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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