Struct icu::displaynames::RegionDisplayNames
source · pub struct RegionDisplayNames { /* private fields */ }
Expand description
Lookup of the locale-specific display names by region code.
Example
use icu_displaynames::{DisplayNamesOptions, RegionDisplayNames};
use icu_locid::{locale, subtags_region as region};
let locale = locale!("en-001");
let options: DisplayNamesOptions = Default::default();
let display_name = RegionDisplayNames::try_new_unstable(
&icu_testdata::unstable(),
&locale.into(),
options,
)
.expect("Data should load successfully");
assert_eq!(display_name.of(region!("AE")), Some("United Arab Emirates"));
Implementations§
source§impl RegionDisplayNames
impl RegionDisplayNames
sourcepub fn try_new_unstable<D>(
data_provider: &D,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<RegionDisplayNames, DataError>where
D: DataProvider<RegionDisplayNamesV1Marker> + ?Sized,
pub fn try_new_unstable<D>( data_provider: &D, locale: &DataLocale, options: DisplayNamesOptions ) -> Result<RegionDisplayNames, DataError>where D: DataProvider<RegionDisplayNamesV1Marker> + ?Sized,
Creates a new RegionDisplayNames
from locale data and an options bag.
⚠️ The bounds on this function may change over time, including in SemVer minor releases.
sourcepub fn try_new_with_any_provider(
provider: &impl AnyProvider,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<RegionDisplayNames, DataError>
pub fn try_new_with_any_provider( provider: &impl AnyProvider, locale: &DataLocale, options: DisplayNamesOptions ) -> Result<RegionDisplayNames, DataError>
Creates a new instance using an AnyProvider
.
For details on the behavior of this function, see: Self::try_new_unstable
sourcepub fn try_new_with_buffer_provider(
provider: &impl BufferProvider,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<RegionDisplayNames, DataError>
pub fn try_new_with_buffer_provider( provider: &impl BufferProvider, locale: &DataLocale, options: DisplayNamesOptions ) -> Result<RegionDisplayNames, DataError>
✨ Enabled with the "serde"
feature.
Creates a new instance using a BufferProvider
.
For details on the behavior of this function, see: Self::try_new_unstable
Trait Implementations§
source§impl Default for RegionDisplayNames
impl Default for RegionDisplayNames
source§fn default() -> RegionDisplayNames
fn default() -> RegionDisplayNames
Returns the “default value” for a type. Read more