Struct icu::displaynames::ScriptDisplayNames
source · pub struct ScriptDisplayNames { /* private fields */ }
Expand description
Lookup of the locale-specific display names by script code.
Example
use icu_displaynames::{DisplayNamesOptions, ScriptDisplayNames};
use icu_locid::{locale, subtags_script as script};
let locale = locale!("en-001");
let options: DisplayNamesOptions = Default::default();
let display_name = ScriptDisplayNames::try_new_unstable(
&icu_testdata::unstable(),
&locale.into(),
options,
)
.expect("Data should load successfully");
assert_eq!(display_name.of(script!("Maya")), Some("Mayan hieroglyphs"));
Implementations§
source§impl ScriptDisplayNames
impl ScriptDisplayNames
sourcepub fn try_new_unstable<D>(
data_provider: &D,
locale: &DataLocale,
options: DisplayNamesOptions
) -> Result<ScriptDisplayNames, DataError>where
D: DataProvider<ScriptDisplayNamesV1Marker> + ?Sized,
pub fn try_new_unstable<D>( data_provider: &D, locale: &DataLocale, options: DisplayNamesOptions ) -> Result<ScriptDisplayNames, DataError>where D: DataProvider<ScriptDisplayNamesV1Marker> + ?Sized,
Creates a new ScriptDisplayNames
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<ScriptDisplayNames, DataError>
pub fn try_new_with_any_provider( provider: &impl AnyProvider, locale: &DataLocale, options: DisplayNamesOptions ) -> Result<ScriptDisplayNames, 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<ScriptDisplayNames, DataError>
pub fn try_new_with_buffer_provider( provider: &impl BufferProvider, locale: &DataLocale, options: DisplayNamesOptions ) -> Result<ScriptDisplayNames, 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 ScriptDisplayNames
impl Default for ScriptDisplayNames
source§fn default() -> ScriptDisplayNames
fn default() -> ScriptDisplayNames
Returns the “default value” for a type. Read more