pub struct InferencePolicy {
pub min_score: u16,
pub min_margin: u16,
}Expand description
Acceptance thresholds for heuristic type inference.
Fields§
§min_score: u16Minimum raw score the winning candidate must reach.
min_margin: u16Minimum lead the winner must have over the runner-up.
Implementations§
Source§impl InferencePolicy
impl InferencePolicy
Sourcepub const PRELIMINARY: Self
pub const PRELIMINARY: Self
Preliminary thresholds: reject a lone weak signal and near ties.
min_score = 30 corresponds to exactly one weak signal (for example the
8-byte pointer heuristic), min_margin = 10 rejects candidates that are
less than one signal apart.
§Measured behaviour
On the deterministic four-sample fixture in this module’s tests
(policy::tests::calibration_fixture) this pair answers 2-3 samples with
precision 1.00 (recall 0.50-0.75): printable text and a NUL-terminated C
string are always answered, while a high-entropy buffer and a control-character
block abstain when their candidates are only a few points apart. The exact
count is platform-dependent because is_valid_ptr consults the live process
map, so the test locks the quality contract instead of an exact count. A grid
search over min_score ∈ [0, 80] and min_margin ∈ [0, 30] with
min_precision = 0.85 finds a more permissive pair, but on four samples that
is over-fitting, so the shipped pair stays deliberately conservative.
This is a smoke-level measurement, not a validated calibration: plan §11.2 requires thresholds selected on a validation set of real programs, including layout-based samples built with a controlled allocator, before any accuracy percentage is published.
Trait Implementations§
Source§impl Clone for InferencePolicy
impl Clone for InferencePolicy
impl Copy for InferencePolicy
Source§impl Debug for InferencePolicy
impl Debug for InferencePolicy
Source§impl Default for InferencePolicy
impl Default for InferencePolicy
impl Eq for InferencePolicy
Source§impl PartialEq for InferencePolicy
impl PartialEq for InferencePolicy
impl StructuralPartialEq for InferencePolicy
Auto Trait Implementations§
impl Forget for InferencePolicy
impl Freeze for InferencePolicy
impl RefUnwindSafe for InferencePolicy
impl Send for InferencePolicy
impl Sync for InferencePolicy
impl Unpin for InferencePolicy
impl UnsafeUnpin for InferencePolicy
impl UnwindSafe for InferencePolicy
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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