fn choose_fold(
    case_folds: &[CaseFold],
    full: bool,
) -> Result<Option<&CaseFold>> {
    let mut choice = None;
    for case_fold in case_folds {
        if (full && case_fold.status == CaseStatus::Full)
            || (!full && case_fold.status == CaseStatus::Simple)
            || case_fold.status == CaseStatus::Common
        {
            if choice.is_some() {
                return err!("found multiple matches from: {:?}", case_folds);
            }
            choice = Some(case_fold);
        }
    }
    Ok(choice)
}
/// Given a sequence of case fold mappings, choose exactly one mapping based
/// on the mapping's status. If `full` is true, then full case mappings are
/// selected, otherwise simple case mappings are selected. If there are
/// multiple valid choices, then an error is returned.
Given a sequence of case fold mappings, choose exactly one mapping based
on the mapping's status. If `full` is true, then full case mappings are
selected, otherwise simple case mappings are selected. If there are
multiple valid choices, then an error is returned.
Given a sequence of case fold mappings choose exactly one mapping based on the mapping ' s status . If ` full ` is true then full case mappings are selected otherwise simple case mappings are selected . If there are multiple valid choices then an error is returned .
fn choose_fold(
    case_folds: &[CaseFold],
    full: bool,
) -> Result<Option<&CaseFold>> {
    let mut choice = None;
    for case_fold in case_folds {
        if (full && case_fold.status == CaseStatus::Full)
            || (!full && case_fold.status == CaseStatus::Simple)
            || case_fold.status == CaseStatus::Common
        {
            if choice.is_some() {
                return err!("found multiple matches from: {:?}", case_folds);
            }
            choice = Some(case_fold);
        }
    }
    Ok(choice)
}
fn choose_fold ( case_folds : & [ CaseFold ] , full : bool , ) -> Result < Option < & CaseFold > > { let mut choice = None ; for case_fold in case_folds { if ( full && case_fold . status == CaseStatus :: Full ) || ( ! full && case_fold . status == CaseStatus :: Simple ) || case_fold . status == CaseStatus :: Common { if choice . is_some ( ) { return err ! ( " " case_folds ) ; } choice = Some ( case_fold ) ; } } Ok ( choice ) }
Given a sequence of case fold mappings, choose exactly one mapping based
on the mapping's status.
Given a sequence of case fold mappings choose exactly one mapping based on the mapping ' s status .
case_folds
&[CaseFold]
full
bool
case_folds
&[CaseFold]
full
bool