pub struct DisplayNames { /* private fields */ }
Expand description

Lookup of the terrritory display names by region code.

Example

use icu_displaynames::displaynames::DisplayNames;
use icu_displaynames::options::DisplayNamesOptions;
use icu_locid::locale;

let locale = locale!("en-001");
let options: DisplayNamesOptions = Default::default();
let display_name = DisplayNames::try_new_region_unstable(
    &icu_testdata::unstable(),
    &locale.into(),
    options,
)
.expect("Data should load successfully");

let region_code = "AE";
assert_eq!(display_name.of(&region_code), Some("United Arab Emirates"));

Implementations

Creates a new DisplayNames from locale data and an options bag.

📚 Help choosing a constructor

⚠️ The bounds on this function may change over time, including in SemVer minor releases.

Creates a new instance using an AnyProvider.

For details on the behavior of this function, see: Self::try_new_region_unstable

📚 Help choosing a constructor

Enabled with the "serde" feature.

Creates a new instance using a BufferProvider.

For details on the behavior of this function, see: Self::try_new_region_unstable

📚 Help choosing a constructor

Returns the display name of the region for a given string. This function is locale-sensitive.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.