pub struct LocalePreferences {
pub(crate) language: Language,
pub(crate) script: Option<Script>,
pub(crate) region: Option<RegionalSubdivision>,
pub(crate) variant: Option<Variant>,
pub(crate) region_override: Option<RegionOverride>,
}Expand description
The structure storing locale subtags used in preferences.
Fields§
§language: LanguagePreference of Language
script: Option<Script>Preference of Script
region: Option<RegionalSubdivision>Preference of Region/Subdivision
variant: Option<Variant>Preference of Variant
region_override: Option<RegionOverride>Preference of Unicode region override
Implementations§
Source§impl LocalePreferences
impl LocalePreferences
Sourcepub const fn to_data_locale_region_priority(self) -> DataLocale
pub const fn to_data_locale_region_priority(self) -> DataLocale
Convert to a DataLocale, with region-based fallback priority
Most users should use icu_provider::marker::make_locale() instead.
Sourcepub const fn to_data_locale_language_priority(self) -> DataLocale
pub const fn to_data_locale_language_priority(self) -> DataLocale
Convert to a DataLocale, with language-based fallback priority
Most users should use icu_provider::marker::make_locale() instead.
Source§impl LocalePreferences
impl LocalePreferences
Sourcepub const fn default() -> Self
pub const fn default() -> Self
Constructs a new LocalePreferences struct with the defaults.
Sourcepub fn from_locale_strict(loc: &Locale) -> Result<Self, Self>
pub fn from_locale_strict(loc: &Locale) -> Result<Self, Self>
Construct a LocalePreferences from a Locale
Returns Err if any of of the preference values are invalid.
Sourcepub const fn language(&self) -> Language
👎Deprecated since 2.2.0: convert to DataLocale to access fields
pub const fn language(&self) -> Language
convert to DataLocale to access fields
Preference of Language
Sourcepub const fn region(&self) -> Option<Region>
👎Deprecated since 2.2.0: convert to DataLocale to access fields
pub const fn region(&self) -> Option<Region>
convert to DataLocale to access fields
Preference of Region
Sourcepub fn extend(&mut self, other: LocalePreferences)
pub fn extend(&mut self, other: LocalePreferences)
Extends the preferences with the values from another set of preferences.
Trait Implementations§
Source§impl Clone for LocalePreferences
impl Clone for LocalePreferences
Source§fn clone(&self) -> LocalePreferences
fn clone(&self) -> LocalePreferences
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LocalePreferences
impl Debug for LocalePreferences
Source§impl Default for LocalePreferences
impl Default for LocalePreferences
Source§impl From<&LanguageIdentifier> for LocalePreferences
impl From<&LanguageIdentifier> for LocalePreferences
Source§fn from(lid: &LanguageIdentifier) -> Self
fn from(lid: &LanguageIdentifier) -> Self
Source§impl From<&Locale> for LocalePreferences
impl From<&Locale> for LocalePreferences
Source§impl From<LocalePreferences> for Locale
Available on crate feature alloc only.✨ Enabled with the alloc Cargo feature.
impl From<LocalePreferences> for Locale
alloc only.✨ Enabled with the alloc Cargo feature.
Source§fn from(prefs: LocalePreferences) -> Self
fn from(prefs: LocalePreferences) -> Self
Source§impl Hash for LocalePreferences
impl Hash for LocalePreferences
Source§impl PartialEq for LocalePreferences
impl PartialEq for LocalePreferences
Source§fn eq(&self, other: &LocalePreferences) -> bool
fn eq(&self, other: &LocalePreferences) -> bool
self and other values to be equal, and is used by ==.