icu_locale_core/preferences/extensions/unicode/keywords/
collation.rs

1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5use crate::preferences::extensions::unicode::enum_keyword;
6
7#[non_exhaustive]
#[doc =
r" A Unicode Collation Identifier defines a type of collation (sort order)."]
#[doc = r""]
#[doc =
r" The valid values are listed in [LDML](https://unicode.org/reports/tr35/#UnicodeCollationIdentifier)."]
pub enum CollationType {

    #[doc = r" A previous version of the ordering, for compatibility"]
    Compat,

    #[doc = r" Dictionary style ordering (such as in Sinhala)"]
    Dict,

    #[doc = r" The default Unicode collation element table order"]
    Ducet,

    #[doc = r" Recommended ordering for emoji characters"]
    Emoji,

    #[doc = r" European ordering rules"]
    Eor,

    #[doc = r" Phonebook style ordering (such as in German)"]
    Phonebk,

    #[doc = r" Phonetic ordering (sorting based on pronunciation)"]
    Phonetic,

    #[doc =
    r" Pinyin ordering for Latin and for CJK characters (used in Chinese)"]
    Pinyin,

    #[doc = r" Special collation type for string search"]
    Search,

    #[doc = r" Special collation type for Korean initial consonant search"]
    Searchjl,

    #[doc = r" Default ordering for each language"]
    Standard,

    #[doc =
    r" Pinyin ordering for Latin, stroke order for CJK characters (used in Chinese)"]
    Stroke,

    #[doc = r" Traditional style ordering (such as in Spanish)"]
    Trad,

    #[doc =
    r" Pinyin ordering for Latin, Unihan radical-stroke ordering for CJK characters (used in Chinese)"]
    Unihan,

    #[doc =
    r" Pinyin ordering for Latin, zhuyin order for Bopomofo and CJK characters (used in Chinese)"]
    Zhuyin,
}
#[automatically_derived]
impl ::core::fmt::Debug for CollationType {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CollationType::Compat => "Compat",
                CollationType::Dict => "Dict",
                CollationType::Ducet => "Ducet",
                CollationType::Emoji => "Emoji",
                CollationType::Eor => "Eor",
                CollationType::Phonebk => "Phonebk",
                CollationType::Phonetic => "Phonetic",
                CollationType::Pinyin => "Pinyin",
                CollationType::Search => "Search",
                CollationType::Searchjl => "Searchjl",
                CollationType::Standard => "Standard",
                CollationType::Stroke => "Stroke",
                CollationType::Trad => "Trad",
                CollationType::Unihan => "Unihan",
                CollationType::Zhuyin => "Zhuyin",
            })
    }
}
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CollationType { }
#[automatically_derived]
impl ::core::clone::Clone for CollationType {
    #[inline]
    fn clone(&self) -> CollationType { *self }
}
#[automatically_derived]
impl ::core::cmp::Eq for CollationType {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
impl ::core::marker::StructuralPartialEq for CollationType { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CollationType {
    #[inline]
    fn eq(&self, other: &CollationType) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}
#[automatically_derived]
impl ::core::marker::Copy for CollationType { }
#[automatically_derived]
impl ::core::hash::Hash for CollationType {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}
impl crate::preferences::PreferenceKey for CollationType {
    fn unicode_extension_key() -> Option<crate::extensions::unicode::Key> {
        Some(const {
                    use crate::extensions::unicode::Key;
                    match Key::try_from_utf8("co".as_bytes()) {
                        Ok(r) => r,
                        _ => {
                            ::core::panicking::panic_fmt(format_args!("Invalid extensions::unicode::Key: co"));
                        }
                    }
                })
    }
    fn try_from_key_value(key: &crate::extensions::unicode::Key,
        value: &crate::extensions::unicode::Value)
        ->
            Result<Option<Self>,
            crate::preferences::extensions::unicode::errors::PreferencesParseError> {
        if Self::unicode_extension_key() == Some(*key) {
            Self::try_from(value).map(Some)
        } else { Ok(None) }
    }
    fn unicode_extension_value(&self)
        -> Option<crate::extensions::unicode::Value> {
        Some((*self).into())
    }
}
impl TryFrom<&crate::extensions::unicode::Value> for CollationType {
    type Error =
        crate::preferences::extensions::unicode::errors::PreferencesParseError;
    fn try_from(s: &crate::extensions::unicode::Value)
        -> Result<Self, Self::Error> {
        let subtag =
            s.get_subtag(0).unwrap_or(&const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("true".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: true"));
                                }
                            }
                        });
        #[allow(unused_imports)]
        use crate::extensions::unicode::value;
        Ok(match subtag.as_str() {
                "compat" => { CollationType::Compat }
                "dict" => { CollationType::Dict }
                "ducet" => { CollationType::Ducet }
                "emoji" => { CollationType::Emoji }
                "eor" => { CollationType::Eor }
                "phonebk" => { CollationType::Phonebk }
                "phonetic" => { CollationType::Phonetic }
                "pinyin" => { CollationType::Pinyin }
                "search" => { CollationType::Search }
                "searchjl" => { CollationType::Searchjl }
                "standard" => { CollationType::Standard }
                "stroke" => { CollationType::Stroke }
                "trad" => { CollationType::Trad }
                "unihan" => { CollationType::Unihan }
                "zhuyin" => { CollationType::Zhuyin }
                _ => { return Err(Self::Error::InvalidKeywordValue); }
            })
    }
}
impl From<CollationType> for crate::extensions::unicode::Value {
    fn from(input: CollationType) -> crate::extensions::unicode::Value {
        let f;
        #[allow(unused_mut)]
        let mut s = None;
        match input
            {
                #[allow(non_snake_case)]
                CollationType::Compat => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("compat".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: compat"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Dict => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("dict".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: dict"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Ducet => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("ducet".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: ducet"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Emoji => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("emoji".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: emoji"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Eor => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("eor".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: eor"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Phonebk => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("phonebk".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: phonebk"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Phonetic => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("phonetic".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: phonetic"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Pinyin => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("pinyin".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: pinyin"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Search => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("search".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: search"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Searchjl => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("searchjl".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: searchjl"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Standard => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("standard".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: standard"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Stroke => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("stroke".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: stroke"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Trad => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("trad".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: trad"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Unihan => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("unihan".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: unihan"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationType::Zhuyin => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("zhuyin".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: zhuyin"));
                                }
                            }
                        };
            }
        }
        if let Some(s) = s {
            crate::extensions::unicode::Value::from_two_subtags(f, s)
        } else { crate::extensions::unicode::Value::from_subtag(Some(f)) }
    }
}
impl CollationType {
    /// A helper function for displaying as a `&str`.
    pub const fn as_str(&self) -> &'static str {
        match self
            {
                #[allow(non_snake_case)]
                Self::Compat => {
                return "compat";
            }
                #[allow(non_snake_case)]
                Self::Dict => {
                return "dict";
            }
                #[allow(non_snake_case)]
                Self::Ducet => {
                return "ducet";
            }
                #[allow(non_snake_case)]
                Self::Emoji => {
                return "emoji";
            }
                #[allow(non_snake_case)]
                Self::Eor => {
                return "eor";
            }
                #[allow(non_snake_case)]
                Self::Phonebk => {
                return "phonebk";
            }
                #[allow(non_snake_case)]
                Self::Phonetic => {
                return "phonetic";
            }
                #[allow(non_snake_case)]
                Self::Pinyin => {
                return "pinyin";
            }
                #[allow(non_snake_case)]
                Self::Search => {
                return "search";
            }
                #[allow(non_snake_case)]
                Self::Searchjl => {
                return "searchjl";
            }
                #[allow(non_snake_case)]
                Self::Standard => {
                return "standard";
            }
                #[allow(non_snake_case)]
                Self::Stroke => {
                return "stroke";
            }
                #[allow(non_snake_case)]
                Self::Trad => {
                return "trad";
            }
                #[allow(non_snake_case)]
                Self::Unihan => {
                return "unihan";
            }
                #[allow(non_snake_case)]
                Self::Zhuyin => {
                return "zhuyin";
            }
        }
    }
}enum_keyword!(
8    /// A Unicode Collation Identifier defines a type of collation (sort order).
9    ///
10    /// The valid values are listed in [LDML](https://unicode.org/reports/tr35/#UnicodeCollationIdentifier).
11    CollationType {
12        /// A previous version of the ordering, for compatibility
13        ("compat" => Compat),
14        /// Dictionary style ordering (such as in Sinhala)
15        ("dict" => Dict),
16        /// The default Unicode collation element table order
17        ("ducet" => Ducet),
18        /// Recommended ordering for emoji characters
19        ("emoji" => Emoji),
20        /// European ordering rules
21        ("eor" => Eor),
22        /// Phonebook style ordering (such as in German)
23        ("phonebk" => Phonebk),
24        /// Phonetic ordering (sorting based on pronunciation)
25        ("phonetic" => Phonetic),
26        /// Pinyin ordering for Latin and for CJK characters (used in Chinese)
27        ("pinyin" => Pinyin),
28        /// Special collation type for string search
29        ("search" => Search),
30        /// Special collation type for Korean initial consonant search
31        ("searchjl" => Searchjl),
32        /// Default ordering for each language
33        ("standard" => Standard),
34        /// Pinyin ordering for Latin, stroke order for CJK characters (used in Chinese)
35        ("stroke" => Stroke),
36        /// Traditional style ordering (such as in Spanish)
37        ("trad" => Trad),
38        /// Pinyin ordering for Latin, Unihan radical-stroke ordering for CJK characters (used in Chinese)
39        ("unihan" => Unihan),
40        /// Pinyin ordering for Latin, zhuyin order for Bopomofo and CJK characters (used in Chinese)
41        ("zhuyin" => Zhuyin),
42}, "co");
43
44#[non_exhaustive]
#[doc = r" Collation parameter key for ordering by case."]
#[doc = r""]
#[doc =
r" If set to upper, causes upper case to sort before lower case. If set to lower, causes lower case to sort before upper case."]
#[doc =
r" Useful for locales that have already supported ordering but require different order of cases. Affects case and tertiary levels."]
#[doc = r""]
#[doc =
r" The defails see [LDML](https://unicode.org/reports/tr35/tr35-collation.html#Case_Parameters)."]
pub enum CollationCaseFirst {

    #[doc = r" Upper case to be sorted before lower case"]
    Upper,

    #[doc = r" Lower case to be sorted before upper case"]
    Lower,

    #[doc = r" No special case ordering"]
    #[default]
    False,
}
#[automatically_derived]
impl ::core::default::Default for CollationCaseFirst {
    #[inline]
    fn default() -> CollationCaseFirst { Self::False }
}
#[automatically_derived]
impl ::core::fmt::Debug for CollationCaseFirst {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CollationCaseFirst::Upper => "Upper",
                CollationCaseFirst::Lower => "Lower",
                CollationCaseFirst::False => "False",
            })
    }
}
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CollationCaseFirst { }
#[automatically_derived]
impl ::core::clone::Clone for CollationCaseFirst {
    #[inline]
    fn clone(&self) -> CollationCaseFirst { *self }
}
#[automatically_derived]
impl ::core::cmp::Eq for CollationCaseFirst {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
impl ::core::marker::StructuralPartialEq for CollationCaseFirst { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CollationCaseFirst {
    #[inline]
    fn eq(&self, other: &CollationCaseFirst) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}
#[automatically_derived]
impl ::core::marker::Copy for CollationCaseFirst { }
#[automatically_derived]
impl ::core::hash::Hash for CollationCaseFirst {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}
impl crate::preferences::PreferenceKey for CollationCaseFirst {
    fn unicode_extension_key() -> Option<crate::extensions::unicode::Key> {
        Some(const {
                    use crate::extensions::unicode::Key;
                    match Key::try_from_utf8("kf".as_bytes()) {
                        Ok(r) => r,
                        _ => {
                            ::core::panicking::panic_fmt(format_args!("Invalid extensions::unicode::Key: kf"));
                        }
                    }
                })
    }
    fn try_from_key_value(key: &crate::extensions::unicode::Key,
        value: &crate::extensions::unicode::Value)
        ->
            Result<Option<Self>,
            crate::preferences::extensions::unicode::errors::PreferencesParseError> {
        if Self::unicode_extension_key() == Some(*key) {
            Self::try_from(value).map(Some)
        } else { Ok(None) }
    }
    fn unicode_extension_value(&self)
        -> Option<crate::extensions::unicode::Value> {
        Some((*self).into())
    }
}
impl TryFrom<&crate::extensions::unicode::Value> for CollationCaseFirst {
    type Error =
        crate::preferences::extensions::unicode::errors::PreferencesParseError;
    fn try_from(s: &crate::extensions::unicode::Value)
        -> Result<Self, Self::Error> {
        let subtag =
            s.get_subtag(0).unwrap_or(&const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("true".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: true"));
                                }
                            }
                        });
        #[allow(unused_imports)]
        use crate::extensions::unicode::value;
        Ok(match subtag.as_str() {
                "upper" => { CollationCaseFirst::Upper }
                "lower" => { CollationCaseFirst::Lower }
                "false" => { CollationCaseFirst::False }
                _ => { return Err(Self::Error::InvalidKeywordValue); }
            })
    }
}
impl From<CollationCaseFirst> for crate::extensions::unicode::Value {
    fn from(input: CollationCaseFirst) -> crate::extensions::unicode::Value {
        let f;
        #[allow(unused_mut)]
        let mut s = None;
        match input
            {
                #[allow(non_snake_case)]
                CollationCaseFirst::Upper => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("upper".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: upper"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationCaseFirst::Lower => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("lower".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: lower"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationCaseFirst::False => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("false".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: false"));
                                }
                            }
                        };
            }
        }
        if let Some(s) = s {
            crate::extensions::unicode::Value::from_two_subtags(f, s)
        } else { crate::extensions::unicode::Value::from_subtag(Some(f)) }
    }
}
impl CollationCaseFirst {
    /// A helper function for displaying as a `&str`.
    pub const fn as_str(&self) -> &'static str {
        match self
            {
                #[allow(non_snake_case)]
                Self::Upper => {
                return "upper";
            }
                #[allow(non_snake_case)]
                Self::Lower => {
                return "lower";
            }
                #[allow(non_snake_case)]
                Self::False => {
                return "false";
            }
        }
    }
}enum_keyword!(
45    /// Collation parameter key for ordering by case.
46    ///
47    /// If set to upper, causes upper case to sort before lower case. If set to lower, causes lower case to sort before upper case.
48    /// Useful for locales that have already supported ordering but require different order of cases. Affects case and tertiary levels.
49    ///
50    /// The defails see [LDML](https://unicode.org/reports/tr35/tr35-collation.html#Case_Parameters).
51    [Default]
52    CollationCaseFirst {
53        /// Upper case to be sorted before lower case
54        ("upper" => Upper),
55        /// Lower case to be sorted before upper case
56        ("lower" => Lower),
57        /// No special case ordering
58        [default]
59        ("false" => False),
60}, "kf");
61
62#[non_exhaustive]
#[doc = r" Collation parameter key for numeric handling."]
#[doc = r""]
#[doc =
r" If set to on, any sequence of Decimal Digits (General_Category = Nd in the UAX44) is sorted at a primary level with"]
#[doc =
r#" its numeric value. For example, "1" < "2" < "10". The computed primary weights are all at the start of the digit"#]
#[doc = r" reordering group."]
pub enum CollationNumericOrdering {

    #[doc =
    r" A sequence of decimal digits is sorted at primary level with its numeric value"]
    True,

    #[doc = r" No special handling for numeric ordering"]
    #[default]
    False,
}
#[automatically_derived]
impl ::core::default::Default for CollationNumericOrdering {
    #[inline]
    fn default() -> CollationNumericOrdering { Self::False }
}
#[automatically_derived]
impl ::core::fmt::Debug for CollationNumericOrdering {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CollationNumericOrdering::True => "True",
                CollationNumericOrdering::False => "False",
            })
    }
}
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CollationNumericOrdering { }
#[automatically_derived]
impl ::core::clone::Clone for CollationNumericOrdering {
    #[inline]
    fn clone(&self) -> CollationNumericOrdering { *self }
}
#[automatically_derived]
impl ::core::cmp::Eq for CollationNumericOrdering {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
impl ::core::marker::StructuralPartialEq for CollationNumericOrdering { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CollationNumericOrdering {
    #[inline]
    fn eq(&self, other: &CollationNumericOrdering) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}
#[automatically_derived]
impl ::core::marker::Copy for CollationNumericOrdering { }
#[automatically_derived]
impl ::core::hash::Hash for CollationNumericOrdering {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}
impl crate::preferences::PreferenceKey for CollationNumericOrdering {
    fn unicode_extension_key() -> Option<crate::extensions::unicode::Key> {
        Some(const {
                    use crate::extensions::unicode::Key;
                    match Key::try_from_utf8("kn".as_bytes()) {
                        Ok(r) => r,
                        _ => {
                            ::core::panicking::panic_fmt(format_args!("Invalid extensions::unicode::Key: kn"));
                        }
                    }
                })
    }
    fn try_from_key_value(key: &crate::extensions::unicode::Key,
        value: &crate::extensions::unicode::Value)
        ->
            Result<Option<Self>,
            crate::preferences::extensions::unicode::errors::PreferencesParseError> {
        if Self::unicode_extension_key() == Some(*key) {
            Self::try_from(value).map(Some)
        } else { Ok(None) }
    }
    fn unicode_extension_value(&self)
        -> Option<crate::extensions::unicode::Value> {
        Some((*self).into())
    }
}
impl TryFrom<&crate::extensions::unicode::Value> for CollationNumericOrdering
    {
    type Error =
        crate::preferences::extensions::unicode::errors::PreferencesParseError;
    fn try_from(s: &crate::extensions::unicode::Value)
        -> Result<Self, Self::Error> {
        let subtag =
            s.get_subtag(0).unwrap_or(&const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("true".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: true"));
                                }
                            }
                        });
        #[allow(unused_imports)]
        use crate::extensions::unicode::value;
        Ok(match subtag.as_str() {
                "true" => { CollationNumericOrdering::True }
                "false" => { CollationNumericOrdering::False }
                _ => { return Err(Self::Error::InvalidKeywordValue); }
            })
    }
}
impl From<CollationNumericOrdering> for crate::extensions::unicode::Value {
    fn from(input: CollationNumericOrdering)
        -> crate::extensions::unicode::Value {
        let f;
        #[allow(unused_mut)]
        let mut s = None;
        match input
            {
                #[allow(non_snake_case)]
                CollationNumericOrdering::True => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("true".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: true"));
                                }
                            }
                        };
            }
                #[allow(non_snake_case)]
                CollationNumericOrdering::False => {
                f =
                    const {
                            use crate::subtags::Subtag;
                            match Subtag::try_from_utf8("false".as_bytes()) {
                                Ok(r) => r,
                                _ => {
                                    ::core::panicking::panic_fmt(format_args!("Invalid subtags::Subtag: false"));
                                }
                            }
                        };
            }
        }
        if let Some(s) = s {
            crate::extensions::unicode::Value::from_two_subtags(f, s)
        } else { crate::extensions::unicode::Value::from_subtag(Some(f)) }
    }
}
impl CollationNumericOrdering {
    /// A helper function for displaying as a `&str`.
    pub const fn as_str(&self) -> &'static str {
        match self
            {
                #[allow(non_snake_case)]
                Self::True => {
                return "true";
            }
                #[allow(non_snake_case)]
                Self::False => {
                return "false";
            }
        }
    }
}enum_keyword!(
63    /// Collation parameter key for numeric handling.
64    ///
65    /// If set to on, any sequence of Decimal Digits (General_Category = Nd in the UAX44) is sorted at a primary level with
66    /// its numeric value. For example, "1" < "2" < "10". The computed primary weights are all at the start of the digit
67    /// reordering group.
68    [Default]
69    CollationNumericOrdering {
70        /// A sequence of decimal digits is sorted at primary level with its numeric value
71        ("true" => True),
72        /// No special handling for numeric ordering
73        [default]
74        ("false" => False),
75}, "kn");