pub enum PreservationVerdict {
Preserved {
score: f64,
threshold: f64,
},
Rejected {
score: f64,
threshold: f64,
},
Unchanged {
byte_len: usize,
},
}Expand description
Outcome of a preservation evaluation against a configurable threshold.
PreservationVerdict is the wire type the enrich pipeline emits in its
NDJSON stream: every body-enrich attempt ends in one of the four
variants so callers can route the result without re-running the
similarity computation.
Variants§
Preserved
The rewritten body is at least threshold-similar to the original.
Rejected
The rewritten body diverges too much from the original and was rejected by the gate.
Unchanged
The original and rewritten bodies are byte-equal (no rewrite was needed); preserved by definition.
Implementations§
Source§impl PreservationVerdict
impl PreservationVerdict
Sourcepub fn evaluate(original: &str, rewritten: &str, threshold: f64) -> Self
pub fn evaluate(original: &str, rewritten: &str, threshold: f64) -> Self
Evaluates the gate against threshold and returns the matching
variant. The threshold is clamped to [0.0, 1.0] defensively; an
out-of-range value does not panic the caller.
Sourcepub fn is_accepted(&self) -> bool
pub fn is_accepted(&self) -> bool
Returns true when the gate accepted the rewrite.
Trait Implementations§
Source§impl Clone for PreservationVerdict
impl Clone for PreservationVerdict
Source§fn clone(&self) -> PreservationVerdict
fn clone(&self) -> PreservationVerdict
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PreservationVerdict
impl Debug for PreservationVerdict
Source§impl<'de> Deserialize<'de> for PreservationVerdict
impl<'de> Deserialize<'de> for PreservationVerdict
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>,
Source§impl PartialEq for PreservationVerdict
impl PartialEq for PreservationVerdict
Source§fn eq(&self, other: &PreservationVerdict) -> bool
fn eq(&self, other: &PreservationVerdict) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PreservationVerdict
impl Serialize for PreservationVerdict
impl StructuralPartialEq for PreservationVerdict
Auto Trait Implementations§
impl Freeze for PreservationVerdict
impl RefUnwindSafe for PreservationVerdict
impl Send for PreservationVerdict
impl Sync for PreservationVerdict
impl Unpin for PreservationVerdict
impl UnsafeUnpin for PreservationVerdict
impl UnwindSafe for PreservationVerdict
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>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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