pub struct ICU4XLocale(pub Locale);
Expand description
An ICU4X Locale, capable of representing strings like "en-US"
.
Tuple Fields§
§0: Locale
Implementations§
Source§impl ICU4XLocale
impl ICU4XLocale
Sourcepub fn create_from_string(
name: &DiplomatStr,
) -> Result<Box<ICU4XLocale>, ICU4XError>
pub fn create_from_string( name: &DiplomatStr, ) -> Result<Box<ICU4XLocale>, ICU4XError>
Construct an ICU4XLocale
from an locale identifier.
This will run the complete locale parsing algorithm. If code size and
performance are critical and the locale is of a known shape (such as
aa-BB
) use create_und
, set_language
, set_script
, and set_region
.
Sourcepub fn create_und() -> Box<ICU4XLocale>
pub fn create_und() -> Box<ICU4XLocale>
Construct a default undefined ICU4XLocale
“und”.
Sourcepub fn clone(&self) -> Box<ICU4XLocale>
pub fn clone(&self) -> Box<ICU4XLocale>
Clones the ICU4XLocale
.
Sourcepub fn basename(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
pub fn basename(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
Write a string representation of the LanguageIdentifier
part of
ICU4XLocale
to write
.
Sourcepub fn get_unicode_extension(
&self,
bytes: &DiplomatStr,
write: &mut DiplomatWriteable,
) -> Result<(), ICU4XError>
pub fn get_unicode_extension( &self, bytes: &DiplomatStr, write: &mut DiplomatWriteable, ) -> Result<(), ICU4XError>
Write a string representation of the unicode extension to write
Sourcepub fn language(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
pub fn language(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
Write a string representation of ICU4XLocale
language to write
Sourcepub fn set_language(&mut self, bytes: &DiplomatStr) -> Result<(), ICU4XError>
pub fn set_language(&mut self, bytes: &DiplomatStr) -> Result<(), ICU4XError>
Set the language part of the ICU4XLocale
.
Sourcepub fn region(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
pub fn region(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
Write a string representation of ICU4XLocale
region to write
Sourcepub fn set_region(&mut self, bytes: &DiplomatStr) -> Result<(), ICU4XError>
pub fn set_region(&mut self, bytes: &DiplomatStr) -> Result<(), ICU4XError>
Set the region part of the ICU4XLocale
.
Sourcepub fn script(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
pub fn script(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
Write a string representation of ICU4XLocale
script to write
Sourcepub fn set_script(&mut self, bytes: &DiplomatStr) -> Result<(), ICU4XError>
pub fn set_script(&mut self, bytes: &DiplomatStr) -> Result<(), ICU4XError>
Set the script part of the ICU4XLocale
. Pass an empty string to remove the script.
Sourcepub fn canonicalize(
bytes: &DiplomatStr,
write: &mut DiplomatWriteable,
) -> Result<(), ICU4XError>
pub fn canonicalize( bytes: &DiplomatStr, write: &mut DiplomatWriteable, ) -> Result<(), ICU4XError>
Best effort locale canonicalizer that doesn’t need any data
Use ICU4XLocaleCanonicalizer for better control and functionality
Sourcepub fn to_string(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
pub fn to_string(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>
Write a string representation of ICU4XLocale
to write