Skip to main content

ConfidenceScore

Struct ConfidenceScore 

Source
pub struct ConfidenceScore { /* private fields */ }
Expand description

Builder for computing detection confidence from weighted signals.

Instead of hardcoded confidence values, each adapter accumulates signals (config files found, test dirs present, runner available, etc.) that dynamically determine how confident we are in the detection.

§Example

let confidence = ConfidenceScore::base(0.50)
    .signal(0.20, project_dir.join("tests").is_dir())
    .signal(0.10, project_dir.join("Cargo.lock").exists())
    .signal(0.10, which::which("cargo").is_ok())
    .finish();

Implementations§

Source§

impl ConfidenceScore

Source

pub fn base(score: f32) -> Self

Start with base confidence from the primary project marker being found.

Source

pub fn signal(self, weight: f32, present: bool) -> Self

Add weight when a confirmatory signal is present.

Source

pub fn finish(self) -> f32

Return final confidence clamped to [0.0, 0.99].

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.