fn names_to_codepoint(
    data: &BTreeMap<Codepoint, UnicodeData>,
    aliases: &Option<BTreeMap<Codepoint, Vec<NameAlias>>>,
    ideograph: bool,
    hangul: bool,
) -> BTreeMap<String, (NameTag, u32)> {
    // The order in which we write names is important, since there is some
    // overlap.
    //
    // Basically, if a character has a "canonical" name that is equivalent to
    // one of its aliases, then overwrite the alias with the canonical name.
    // The effect is that its tag will be Explicit rather than Alias.
    //
    // Additionally, write the algorithmically generated names after
    // everything, so that even if a algorithmically generated name matches
    // an Explicit/Alias name, its tag will indicate that it is generated.
    let mut map = BTreeMap::new();
    if let Some(ref alias_map) = *aliases {
        for (cp, aliases) in alias_map {
            for name_alias in aliases {
                let v = (NameTag::Alias, cp.value());
                map.insert(name_alias.alias.clone(), v);
            }
        }
    }
    for (cp, datum) in data {
        let isnull = datum.name.is_empty()
            || (datum.name.starts_with('<') && datum.name.ends_with('>'));
        if !isnull {
            let v = (NameTag::Explicit, cp.value());
            map.insert(datum.name.clone(), v);
        }
    }
    if ideograph {
        for &(start, end) in ucd_util::RANGE_IDEOGRAPH {
            for cp in start..end + 1 {
                let v = (NameTag::Ideograph, cp);
                map.insert(ucd_util::ideograph_name(cp).unwrap(), v);
            }
        }
    }
    if hangul {
        for &(start, end) in ucd_util::RANGE_HANGUL_SYLLABLE {
            for cp in start..end + 1 {
                let v = (NameTag::Hangul, cp);
                map.insert(ucd_util::hangul_name(cp).unwrap(), v);
            }
        }
    }
    map
}
/// Build one big map in memory from every possible name of a character to its
/// corresponding codepoint. One codepoint may be pointed to by multiple names.
///
/// The return value maps each name to its corresponding codepoint, along with
/// a tag associated with how that mapping was generated.
Build one big map in memory from every possible name of a character to its
corresponding codepoint. One codepoint may be pointed to by multiple names.

The return value maps each name to its corresponding codepoint, along with
a tag associated with how that mapping was generated.
Build one big map in memory from every possible name of a character to its corresponding codepoint . One codepoint may be pointed to by multiple names . The return value maps each name to its corresponding codepoint along with a tag associated with how that mapping was generated .
fn names_to_codepoint(
    data: &BTreeMap<Codepoint, UnicodeData>,
    aliases: &Option<BTreeMap<Codepoint, Vec<NameAlias>>>,
    ideograph: bool,
    hangul: bool,
) -> BTreeMap<String, (NameTag, u32)> {
    // The order in which we write names is important, since there is some
    // overlap.
    //
    // Basically, if a character has a "canonical" name that is equivalent to
    // one of its aliases, then overwrite the alias with the canonical name.
    // The effect is that its tag will be Explicit rather than Alias.
    //
    // Additionally, write the algorithmically generated names after
    // everything, so that even if a algorithmically generated name matches
    // an Explicit/Alias name, its tag will indicate that it is generated.
    let mut map = BTreeMap::new();
    if let Some(ref alias_map) = *aliases {
        for (cp, aliases) in alias_map {
            for name_alias in aliases {
                let v = (NameTag::Alias, cp.value());
                map.insert(name_alias.alias.clone(), v);
            }
        }
    }
    for (cp, datum) in data {
        let isnull = datum.name.is_empty()
            || (datum.name.starts_with('<') && datum.name.ends_with('>'));
        if !isnull {
            let v = (NameTag::Explicit, cp.value());
            map.insert(datum.name.clone(), v);
        }
    }
    if ideograph {
        for &(start, end) in ucd_util::RANGE_IDEOGRAPH {
            for cp in start..end + 1 {
                let v = (NameTag::Ideograph, cp);
                map.insert(ucd_util::ideograph_name(cp).unwrap(), v);
            }
        }
    }
    if hangul {
        for &(start, end) in ucd_util::RANGE_HANGUL_SYLLABLE {
            for cp in start..end + 1 {
                let v = (NameTag::Hangul, cp);
                map.insert(ucd_util::hangul_name(cp).unwrap(), v);
            }
        }
    }
    map
}
fn names_to_codepoint ( data : & BTreeMap < Codepoint , UnicodeData > , aliases : & Option < BTreeMap < Codepoint , Vec < NameAlias > > > , ideograph : bool , hangul : bool , ) -> BTreeMap < String , ( NameTag , u32 ) > { // The order in which we write names is important, since there is some // overlap. // // Basically, if a character has a "canonical" name that is equivalent to // one of its aliases, then overwrite the alias with the canonical name. // The effect is that its tag will be Explicit rather than Alias. // // Additionally, write the algorithmically generated names after // everything, so that even if a algorithmically generated name matches // an Explicit/Alias name, its tag will indicate that it is generated. let mut map = BTreeMap :: new ( ) ; if let Some ( ref alias_map ) = * aliases { for ( cp , aliases ) in alias_map { for name_alias in aliases { let v = ( NameTag :: Alias , cp . value ( ) ) ; map . insert ( name_alias . alias . clone ( ) , v ) ; } } } for ( cp , datum ) in data { let isnull = datum . name . is_empty ( ) || ( datum . name . starts_with ( '<' ) && datum . name . ends_with ( '>' ) ) ; if ! isnull { let v = ( NameTag :: Explicit , cp . value ( ) ) ; map . insert ( datum . name . clone ( ) , v ) ; } } if ideograph { for & ( start , end ) in ucd_util :: RANGE_IDEOGRAPH { for cp in start .. end + 1 { let v = ( NameTag :: Ideograph , cp ) ; map . insert ( ucd_util :: ideograph_name ( cp ) . unwrap ( ) , v ) ; } } } if hangul { for & ( start , end ) in ucd_util :: RANGE_HANGUL_SYLLABLE { for cp in start .. end + 1 { let v = ( NameTag :: Hangul , cp ) ; map . insert ( ucd_util :: hangul_name ( cp ) . unwrap ( ) , v ) ; } } } map }
Build one big map in memory from every possible name of a character to its
corresponding codepoint.
Build one big map in memory from every possible name of a character to its corresponding codepoint .
data
&BTreeMap<Codepoint, UnicodeData>
aliases
&Option<BTreeMap<Codepoint, Vec<NameAlias>>>
ideograph
bool
hangul
bool
data
&BTreeMap<Codepoint, UnicodeData>
aliases
&Option<BTreeMap<Codepoint, Vec<NameAlias>>>
ideograph
bool
hangul
bool