pub fn canonicalize(&self) -> LanguageTag {
        if let Some(ref language) = self.language {
            if let Some(&(_, Some(tag))) = GRANDFATHERED.iter().find(|&&(x, _)| {
                x.eq_ignore_ascii_case(&language)
            }) {
                return tag.parse().expect("GRANDFATHERED list must contain only valid tags.");
            }
        }
        let mut tag = self.clone();
        if !self.extlangs.is_empty() {
            tag.language = Some(self.extlangs[0].clone());
            tag.extlangs = Vec::new();
        }
        if let Some(ref language) = self.language {
            if let Some(&(_, l)) = DEPRECATED_LANGUAGE.iter().find(|&&(x, _)| {
                x.eq_ignore_ascii_case(&language)
            }) {
                tag.language = Some(l.to_owned());
            };
        }
        if let Some(ref region) = self.region {
            if let Some(&(_, r)) = DEPRECATED_REGION.iter().find(|&&(x, _)| {
                x.eq_ignore_ascii_case(&region)
            }) {
                tag.region = Some(r.to_owned());
            };
        }
        tag.variants = self.variants
                           .iter()
                           .map(|variant| {
                               if "heploc".eq_ignore_ascii_case(variant) {
                                   "alalc97".to_owned()
                               } else {
                                   variant.clone()
                               }
                           })
                           .collect();
        tag
    }
/// Returns the canonical version of the language tag.
///
/// It currently applies the following steps:
///
/// * Grandfathered tags are replaced with the canonical version if possible.
/// * Extension languages are promoted to primary language.
/// * Deprecated languages are replaced with modern equivalents.
/// * Deprecated regions are replaced with new country names.
/// * The `heploc` variant is replaced with `alalc97`.
///
/// The returned language tags may not be completly canonical and they are
/// not validated.
Returns the canonical version of the language tag.
It currently applies the following steps.

Grandfathered tags are replaced with the canonical version if possible.
Extension languages are promoted to primary language.
Deprecated languages are replaced with modern equivalents.
Deprecated regions are replaced with new country names.
The `heploc` variant is replaced with `alalc97`.

The returned language tags may not be completly canonical and they are
not validated.
Returns the canonical version of the language tag . It currently applies the following steps . Grandfathered tags are replaced with the canonical version if possible . Extension languages are promoted to primary language . Deprecated languages are replaced with modern equivalents . Deprecated regions are replaced with new country names . The ` heploc ` variant is replaced with ` alalc97 ` . The returned language tags may not be completly canonical and they are not validated .
pub fn canonicalize(&self) -> LanguageTag {
        if let Some(ref language) = self.language {
            if let Some(&(_, Some(tag))) = GRANDFATHERED.iter().find(|&&(x, _)| {
                x.eq_ignore_ascii_case(&language)
            }) {
                return tag.parse().expect("GRANDFATHERED list must contain only valid tags.");
            }
        }
        let mut tag = self.clone();
        if !self.extlangs.is_empty() {
            tag.language = Some(self.extlangs[0].clone());
            tag.extlangs = Vec::new();
        }
        if let Some(ref language) = self.language {
            if let Some(&(_, l)) = DEPRECATED_LANGUAGE.iter().find(|&&(x, _)| {
                x.eq_ignore_ascii_case(&language)
            }) {
                tag.language = Some(l.to_owned());
            };
        }
        if let Some(ref region) = self.region {
            if let Some(&(_, r)) = DEPRECATED_REGION.iter().find(|&&(x, _)| {
                x.eq_ignore_ascii_case(&region)
            }) {
                tag.region = Some(r.to_owned());
            };
        }
        tag.variants = self.variants
                           .iter()
                           .map(|variant| {
                               if "heploc".eq_ignore_ascii_case(variant) {
                                   "alalc97".to_owned()
                               } else {
                                   variant.clone()
                               }
                           })
                           .collect();
        tag
    }
pub fn canonicalize ( & self ) -> LanguageTag { if let Some ( ref language ) = self . language { if let Some ( & ( _ , Some ( tag ) ) ) = GRANDFATHERED . iter ( ) . find ( | & & ( x , _ ) | { x . eq_ignore_ascii_case ( & language ) } ) { return tag . parse ( ) . expect ( " " ) ; } } let mut tag = self . clone ( ) ; if ! self . extlangs . is_empty ( ) { tag . language = Some ( self . extlangs [ 0 ] . clone ( ) ) ; tag . extlangs = Vec :: new ( ) ; } if let Some ( ref language ) = self . language { if let Some ( & ( _ , l ) ) = DEPRECATED_LANGUAGE . iter ( ) . find ( | & & ( x , _ ) | { x . eq_ignore_ascii_case ( & language ) } ) { tag . language = Some ( l . to_owned ( ) ) ; } ; } if let Some ( ref region ) = self . region { if let Some ( & ( _ , r ) ) = DEPRECATED_REGION . iter ( ) . find ( | & & ( x , _ ) | { x . eq_ignore_ascii_case ( & region ) } ) { tag . region = Some ( r . to_owned ( ) ) ; } ; } tag . variants = self . variants . iter ( ) . map ( | variant | { if " " . eq_ignore_ascii_case ( variant ) { " " . to_owned ( ) } else { variant . clone ( ) } } ) . collect ( ) ; tag }
Returns the canonical version of the language tag.
Returns the canonical version of the language tag .
&self
&self