Software Engineering Rust crate
Software engineering metrics models, structs, calculations, and examples — 27 modules covering delivery flow, developer experience, code and test quality, product and business outcomes, reliability and security, and AI-assisted development. One module per topic, based on the book Software Engineering Metrics.
The crate is std-only with minimal dependencies: rusty-money
provides currency-checked Money arithmetic for a handful of financial
functions (see each module's own "Money" section); every other module has
none. Most quantities are f64 (except a few naturally integer or
enum-typed values, such as McCabe cyclomatic complexity and severity
levels), and functions return Option<f64> wherever a denominator could be
zero — except the Money-typed functions, which return
Result<_, rusty_money::MoneyError> instead, since currency mismatches and
overflow are real failure modes plain f64 doesn't have.
Install
Add the dependency to your Cargo.toml:
[]
= "0.2"
Quickstart
A DORA delivery-stability improvement, turned into a financial case:
use change_failure_rate_percent;
use roi;
// A platform team's change failure rate falls from 25% to 8% across
// 100 production deployments/year.
let cfr_before = change_failure_rate_percent.unwrap;
let cfr_after = change_failure_rate_percent.unwrap;
assert_eq!;
assert_eq!;
// 17 fewer failed deployments/year, each avoiding $12,000 of incident
// cost, is $204,000/year of benefit against a $150,000 investment.
let failed_deployments_avoided = 100.0 * / 100.0;
assert_eq!;
let benefit = failed_deployments_avoided * 12_000.0;
assert_eq!;
// ROI = (benefit − cost) / cost = 36%.
let return_on_investment = roi.unwrap;
assert!;
Money
A handful of financial functions have a currency-checked variant built on
rusty-money's Money type,
alongside the plain-f64 version:
use ;
use roi_money;
let benefit = from_major;
let cost = from_major;
assert!;
// A benefit and cost in different currencies is an error, not a silent
// unit mismatch.
let eur_cost = from_major;
assert!;
Module index by theme
Flow metrics
flow_framework— flow velocity, flow distribution, flow time, flow load, Little's law, flow efficiencycycle_time— the five-stage cycle-time breakdown (coding, pickup, review, test, deploy)queueing_theory— utilization and queue stabilitylean_value_stream_metrics— percent complete and accurate, rolled throughput yield, takt timepull_request_metrics— time to first review, reviewer load concentrationdora_metrics— deployment frequency, lead time for changes, change failure rate, recovery time
Developer experience
space_framework— the five SPACE dimensions and coverage checksdeveloper_experience_metrics— focus time, survey response ratesatisfaction_metrics— eNPS-style satisfaction score, satisfaction trendactivity_metrics— commit-splitting gaming signal, activity rate as context only
Code and quality
code_complexity— McCabe cyclomatic complexitytest_effectiveness— test coverage, mutation kill ratecode_churn— code churn, hotspot scoretechnical_debt— debt carrying cost (plain andMoney-typed)static_analysis_metrics— findings per KLOC, severity-weighted finding scoredocumentation_and_knowledge_metrics— bus factor, documentation coverage
Product and business
escaped_defects— escaped defect ratefeature_adoption— initial adoption, retained adoptionunit_economics— unit cost (plain andMoney-typed)return_on_investment— ROI and ROI as a range (plain andMoney-typed)customer_and_business_outcome_metrics— net revenue retention, honestly-scoped outcome claims
Reliability, operations, and security
error_budget— error budget and burn rateincident_metrics— MTTD, MTTA, MTTR, mean durationon_call_metrics— on-call paging concentrationvulnerability_management— severity levels, vulnerability time-to-remediate
AI-assisted development
ai_assisted_development— net cycle-time change, genuine vs false productivity gain
Metrics programs
maturity_model— minimum and average maturity scoring across dimensions
Testing
Every module reproduces its topic's worked example, or a value grounded
directly in the chapter's own text, in unit tests, and every doc example
compiles and asserts under cargo test --doc:
Citation
See CITATION.cff for citation metadata.
License
Any of MIT, Apache-2.0, BSD-3-Clause, GPL-2.0-only, or GPL-3.0-only, at
your option — or contact us for custom license options. See
LICENSE.md.
Tracking
- Package: software-engineering
- Repository: github.com/joelparkerhenderson/software-engineering-rust-crate
- Author: Joel Parker Henderson — joel@joelparkerhenderson.com