pub struct CpdClone {
pub format: String,
pub fragment_a: Fragment,
pub fragment_b: Fragment,
pub token_count: u32,
pub is_new: bool,
pub kind: CloneKind,
pub similarity: Option<f32>,
pub similarity_method: Option<SimilarityMethod>,
pub unmatched_lines: [u32; 2],
}Fields§
§format: String§fragment_a: Fragment§fragment_b: Fragment§token_count: u32§is_new: boolTrue when the clone is absent from the configured baseline (issue #944). Always false when no baseline is in use.
kind: CloneKindexact when the raw tokens of both fragments are identical, renamed
when they match only after normalization (issue #998). Always exact
when no normalization option is on.
similarity: Option<f32>For similar clones: matched tokens divided by the tokens of the
longer merged span, in (0, 1). None for exact and renamed clones.
similarity_method: Option<SimilarityMethod>Which mechanism produced a similar clone; the two scores are not
on the same scale, so reporters show it next to the value.
unmatched_lines: [u32; 2]Lines inside each fragment’s span that the gap merge (--max-gap-lines)
left unmatched, for fragment_a and fragment_b in that order.
Statistics subtract them so gap lines do not count as duplicated.
[0, 0] for every clone the merge pass did not produce.
Implementations§
Source§impl CpdClone
impl CpdClone
Sourcepub fn exact(
format: impl Into<String>,
fragment_a: Fragment,
fragment_b: Fragment,
token_count: u32,
) -> Self
pub fn exact( format: impl Into<String>, fragment_a: Fragment, fragment_b: Fragment, token_count: u32, ) -> Self
An exact clone with no baseline, similarity or gap metadata.
Sourcepub fn similarity_rounded(&self) -> Option<f64>
pub fn similarity_rounded(&self) -> Option<f64>
similarity rounded to three decimals as an f64, the form reporters
print (an f32 widened to JSON would print as 0.8510638475418091).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CpdClone
impl<'de> Deserialize<'de> for CpdClone
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for CpdClone
Auto Trait Implementations§
impl Freeze for CpdClone
impl RefUnwindSafe for CpdClone
impl Send for CpdClone
impl Sync for CpdClone
impl Unpin for CpdClone
impl UnsafeUnpin for CpdClone
impl UnwindSafe for CpdClone
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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