pub trait PokaYoke {
// Required method
fn poka_yoke_validate(&self) -> PokaYokeResult;
// Provided method
fn quality_score(&self) -> u8 { ... }
}Expand description
Extensible Poka-yoke validation trait (implement per model type)
§Example
ⓘ
impl PokaYoke for WhisperModel {
fn validate(&self) -> PokaYokeResult {
let mut result = PokaYokeResult::new();
// Gate 1: Filterbank must be embedded
if self.has_filterbank() {
result.add_gate(Gate::pass("filterbank_present", 20));
} else {
result.add_gate(Gate::fail("filterbank_present", 20,
"Fix: Embed Slaney-normalized filterbank via MelFilterbankData::mel_80()"));
}
// Gate 2: Filterbank must be Slaney-normalized
if let Some(fb) = self.filterbank() {
let max = fb.iter().cloned().fold(f32::NEG_INFINITY, f32::max);
if max < 0.1 {
result.add_gate(Gate::pass("filterbank_normalized", 30));
} else {
result.add_gate(Gate::fail("filterbank_normalized", 30,
format!("Fix: Apply 2.0/bandwidth normalization (max={max:.4}, expected <0.1)")));
}
}
result
}
}Required Methods§
Sourcefn poka_yoke_validate(&self) -> PokaYokeResult
fn poka_yoke_validate(&self) -> PokaYokeResult
Validate model and return quality score (0-100)
Provided Methods§
Sourcefn quality_score(&self) -> u8
fn quality_score(&self) -> u8
Get quality score (convenience method)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".