Skip to main content

CoverageEngine

Struct CoverageEngine 

Source
pub struct CoverageEngine;
Expand description

Stateless engine for building and scoring the coverage matrix.

All methods are pure functions — no internal state is mutated. The struct exists as an organisational namespace.

Implementations§

Source§

impl CoverageEngine

Source

pub fn build_matrix( canonical_asset_ids: &[String], workspaces: &[(PathBuf, Vec<InstalledAsset>)], canonical_hashes: &HashMap<String, String>, canonical_versions: &HashMap<String, String>, ) -> CoverageMatrix

Build the full coverage matrix from canonical assets and scan results.

§Arguments
  • canonical_asset_ids — ordered list of all catalog asset identifiers. Each entry becomes one row in the matrix.
  • workspaces — list of (workspace_name, installed_assets) pairs. Each pair becomes one column and contributes cells for each asset.
  • canonical_hashes — map from asset_id → expected SHA-256 hex (from asset-integrity.json).
  • canonical_versions — map from asset_id → version string (from catalog).

The matrix rows are ordered by canonical_asset_ids, and columns are ordered by the order of workspaces. Coverage scores are computed for each workspace and stored in workspace_scores.

Source

pub fn compute_coverage_score( installed_matching: usize, total_applicable: usize, ) -> Option<f64>

Compute the per-workspace coverage percentage (Req 3.5).

Formula: (installed_matching / total_applicable) × 100, rounded half-up to one decimal place.

Returns None when total_applicable == 0 (workspace has no applicable canonical assets — display as “N/A” in the UI per Req 3.5).

Source

pub fn compute_freshness_score( current_count: usize, total_with_versions: usize, ) -> f64

Compute the freshness score for a workspace (Req 8.3).

Delegates to freshness_score from versions.rs.

Returns 0.0 when total_with_versions == 0.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more