Struct icu::displaynames::displaynames::DisplayNames
source · [−]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(®ion_code), Some("United Arab Emirates"));
Implementations
sourceimpl DisplayNames
impl DisplayNames
sourcepub fn try_new_region_unstable<D>(
data_provider: &D,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<DisplayNames, DataError> where
D: DataProvider<RegionDisplayNamesV1Marker> + ?Sized,
pub fn try_new_region_unstable<D>(
data_provider: &D,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<DisplayNames, DataError> where
D: DataProvider<RegionDisplayNamesV1Marker> + ?Sized,
Creates a new DisplayNames
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_region_with_any_provider(
provider: &impl AnyProvider,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<DisplayNames, DataError>
pub fn try_new_region_with_any_provider(
provider: &impl AnyProvider,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<DisplayNames, DataError>
Creates a new instance using an AnyProvider
.
For details on the behavior of this function, see: Self::try_new_region_unstable
sourcepub fn try_new_region_with_buffer_provider(
provider: &impl BufferProvider,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<DisplayNames, DataError>
pub fn try_new_region_with_buffer_provider(
provider: &impl BufferProvider,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<DisplayNames, 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_region_unstable
Auto Trait Implementations
impl RefUnwindSafe for DisplayNames
impl Send for DisplayNames
impl Sync for DisplayNames
impl Unpin for DisplayNames
impl UnwindSafe for DisplayNames
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more