#[non_exhaustive]pub struct CollatorPreferences {
pub locale_preferences: LocalePreferences,
pub collation_type: Option<CollationType>,
pub case_first: Option<CollationCaseFirst>,
pub numeric_ordering: Option<CollationNumericOrdering>,
}Expand description
The preferences for collation.
§Preferences
Examples for using the different preferences below can be found in the crate-level docs.
§Case First
See the spec.
This is the BCP47 key kf. Three possibilities: CollationCaseFirst::False (default,
except for Danish and Maltese), CollationCaseFirst::Lower, and CollationCaseFirst::Upper
(default for Danish and Maltese).
§Numeric
This is the BCP47 key kn. When set to CollationNumericOrdering::True, any sequence of decimal
digits (General_Category = Nd) is sorted at the primary level according to the
numeric value. The default is CollationNumericOrdering::False.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.locale_preferences: LocalePreferencesLocale Preferences for the Preferences structure.
collation_type: Option<CollationType>The collation type. This corresponds to the -u-co BCP-47 tag.
case_first: Option<CollationCaseFirst>Treatment of case. (Large and small kana differences are treated as case differences.)
This corresponds to the -u-kf BCP-47 tag.
numeric_ordering: Option<CollationNumericOrdering>When set to True, any sequence of decimal digits is sorted at a primary level according
to the numeric value.
This corresponds to the -u-kn BPC-47 tag.
Implementations§
Source§impl CollatorPreferences
impl CollatorPreferences
Sourcepub fn extend(&mut self, other: CollatorPreferences)
pub fn extend(&mut self, other: CollatorPreferences)
Extends the preferences with the values from another set of preferences.
Sourcepub fn from_locale_strict(loc: &Locale) -> Result<Self, Self>
pub fn from_locale_strict(loc: &Locale) -> Result<Self, Self>
Construct a CollatorPreferences from a Locale
Returns Err if any of of the preference values are invalid.
Trait Implementations§
Source§impl Clone for CollatorPreferences
impl Clone for CollatorPreferences
Source§fn clone(&self) -> CollatorPreferences
fn clone(&self) -> CollatorPreferences
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CollatorPreferences
impl Debug for CollatorPreferences
Source§impl Default for CollatorPreferences
impl Default for CollatorPreferences
Source§fn default() -> CollatorPreferences
fn default() -> CollatorPreferences
Source§impl From<&LanguageIdentifier> for CollatorPreferences
impl From<&LanguageIdentifier> for CollatorPreferences
Source§fn from(lid: &LanguageIdentifier) -> Self
fn from(lid: &LanguageIdentifier) -> Self
Source§impl From<&Locale> for CollatorPreferences
impl From<&Locale> for CollatorPreferences
Source§impl From<LanguageIdentifier> for CollatorPreferences
impl From<LanguageIdentifier> for CollatorPreferences
Source§fn from(lid: LanguageIdentifier) -> Self
fn from(lid: LanguageIdentifier) -> Self
Source§impl From<Locale> for CollatorPreferences
impl From<Locale> for CollatorPreferences
Source§impl From<ResolvedCollatorOptions> for CollatorPreferences
impl From<ResolvedCollatorOptions> for CollatorPreferences
Source§fn from(options: ResolvedCollatorOptions) -> CollatorPreferences
fn from(options: ResolvedCollatorOptions) -> CollatorPreferences
Convenience conversion for copying the preferences from an existing collator into a new one.
Note that some preferences may not be fully preserved when recovering them
from an already initialized collator e.g LocalePreferences and CollationType, because
those are only relevant when loading the collation data.