use-accessibility-score 0.0.1

Primitive accessibility scoring helpers
Documentation
  • Coverage
  • 5%
    1 out of 20 items documented1 out of 9 items with examples
  • Size
  • Source code size: 6.91 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 503.9 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-accessibility
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

Primitive accessibility scoring helpers.

The score intentionally stays simple: Pass contributes full weight, Warn contributes half weight, and Fail contributes zero. The final score is normalized to a 0..=100 scale when total weight is positive.

Examples

use use_accessibility_score::{
    AccessibilityCheckResult, CheckStatus, count_failed, count_passed, count_warnings,
    score_results,
};

let results = [
    AccessibilityCheckResult {
        name: String::from("contrast"),
        status: CheckStatus::Pass,
        weight: 2.0,
    },
    AccessibilityCheckResult {
        name: String::from("label"),
        status: CheckStatus::Warn,
        weight: 1.0,
    },
    AccessibilityCheckResult {
        name: String::from("focus"),
        status: CheckStatus::Fail,
        weight: 1.0,
    },
];
let score = score_results(&results).unwrap();

assert_eq!(count_passed(&results), 1);
assert_eq!(count_warnings(&results), 1);
assert_eq!(count_failed(&results), 1);
assert_eq!(score.passed, 1);
assert_eq!(score.warnings, 1);
assert_eq!(score.failed, 1);
assert_eq!(score.score, 62.5);