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
impl CoverageEngine
Sourcepub fn build_matrix(
canonical_asset_ids: &[String],
workspaces: &[(PathBuf, Vec<InstalledAsset>)],
canonical_hashes: &HashMap<String, String>,
canonical_versions: &HashMap<String, String>,
) -> CoverageMatrix
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 fromasset_id→ expected SHA-256 hex (fromasset-integrity.json).canonical_versions— map fromasset_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.
Sourcepub fn compute_coverage_score(
installed_matching: usize,
total_applicable: usize,
) -> Option<f64>
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).
Sourcepub fn compute_freshness_score(
current_count: usize,
total_with_versions: usize,
) -> f64
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§
impl Freeze for CoverageEngine
impl RefUnwindSafe for CoverageEngine
impl Send for CoverageEngine
impl Sync for CoverageEngine
impl Unpin for CoverageEngine
impl UnsafeUnpin for CoverageEngine
impl UnwindSafe for CoverageEngine
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> 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