| 344 | } |
| 345 | |
| 346 | fn ages(canonical_age: &str) -> Result<AgeIter> { |
| 347 | const AGES: &'static [(&'static str, &'static [(char, char)])] = &[ |
| 348 | ("V1_1", age::V1_1), |
| 349 | ("V2_0", age::V2_0), |
| 350 | ("V2_1", age::V2_1), |
| 351 | ("V3_0", age::V3_0), |
| 352 | ("V3_1", age::V3_1), |
| 353 | ("V3_2", age::V3_2), |
| 354 | ("V4_0", age::V4_0), |
| 355 | ("V4_1", age::V4_1), |
| 356 | ("V5_0", age::V5_0), |
| 357 | ("V5_1", age::V5_1), |
| 358 | ("V5_2", age::V5_2), |
| 359 | ("V6_0", age::V6_0), |
| 360 | ("V6_1", age::V6_1), |
| 361 | ("V6_2", age::V6_2), |
| 362 | ("V6_3", age::V6_3), |
| 363 | ("V7_0", age::V7_0), |
| 364 | ("V8_0", age::V8_0), |
| 365 | ("V9_0", age::V9_0), |
| 366 | ("V10_0", age::V10_0), |
| 367 | ("V11_0", age::V11_0), |
| 368 | ]; |
| 369 | assert_eq!(AGES.len(), age::BY_NAME.len(), "ages are out of sync"); |
| 370 | |
| 371 | let pos = AGES.iter().position(|&(age, _)| canonical_age == age); |
| 372 | match pos { |
| 373 | None => Err(Error::PropertyValueNotFound), |
| 374 | Some(i) => Ok(AgeIter { ages: &AGES[..i+1] }), |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | impl Iterator for AgeIter { |
| 379 | type Item = &'static [(char, char)]; |