Struct icu_capi::locale_core::ffi::ICU4XLocale
source · 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>, ICU4XLocaleParseError>
pub fn create_from_string( name: &DiplomatStr ) -> Result<Box<ICU4XLocale>, ICU4XLocaleParseError>
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 DiplomatWrite)
pub fn basename(&self, write: &mut DiplomatWrite)
Returns a string representation of the LanguageIdentifier
part of
ICU4XLocale
.
sourcepub fn get_unicode_extension(
&self,
s: &DiplomatStr,
write: &mut DiplomatWrite
) -> Option<()>
pub fn get_unicode_extension( &self, s: &DiplomatStr, write: &mut DiplomatWrite ) -> Option<()>
Returns a string representation of the unicode extension.
sourcepub fn language(&self, write: &mut DiplomatWrite)
pub fn language(&self, write: &mut DiplomatWrite)
Returns a string representation of ICU4XLocale
language.
sourcepub fn set_language(
&mut self,
s: &DiplomatStr
) -> Result<(), ICU4XLocaleParseError>
pub fn set_language( &mut self, s: &DiplomatStr ) -> Result<(), ICU4XLocaleParseError>
Set the language part of the ICU4XLocale
.
sourcepub fn region(&self, write: &mut DiplomatWrite) -> Option<()>
pub fn region(&self, write: &mut DiplomatWrite) -> Option<()>
Returns a string representation of ICU4XLocale
region.
sourcepub fn set_region(
&mut self,
s: &DiplomatStr
) -> Result<(), ICU4XLocaleParseError>
pub fn set_region( &mut self, s: &DiplomatStr ) -> Result<(), ICU4XLocaleParseError>
Set the region part of the ICU4XLocale
.
sourcepub fn script(&self, write: &mut DiplomatWrite) -> Option<()>
pub fn script(&self, write: &mut DiplomatWrite) -> Option<()>
Returns a string representation of ICU4XLocale
script.
sourcepub fn set_script(
&mut self,
s: &DiplomatStr
) -> Result<(), ICU4XLocaleParseError>
pub fn set_script( &mut self, s: &DiplomatStr ) -> Result<(), ICU4XLocaleParseError>
Set the script part of the ICU4XLocale
. Pass an empty string to remove the script.
sourcepub fn canonicalize(
s: &DiplomatStr,
write: &mut DiplomatWrite
) -> Result<(), ICU4XLocaleParseError>
pub fn canonicalize( s: &DiplomatStr, write: &mut DiplomatWrite ) -> Result<(), ICU4XLocaleParseError>
Best effort locale canonicalizer that doesn’t need any data
Use ICU4XLocaleCanonicalizer for better control and functionality
sourcepub fn to_string(&self, write: &mut DiplomatWrite)
pub fn to_string(&self, write: &mut DiplomatWrite)
Returns a string representation of ICU4XLocale
.
pub fn normalizing_eq(&self, other: &DiplomatStr) -> bool
pub fn strict_cmp(&self, other: &DiplomatStr) -> ICU4XOrdering
pub fn strict_cmp_(&self, other: &DiplomatStr) -> Ordering
pub fn total_cmp(&self, other: &Self) -> ICU4XOrdering
pub fn total_cmp_(&self, other: &Self) -> Ordering
source§impl ICU4XLocale
impl ICU4XLocale
pub fn to_datalocale(&self) -> DataLocale
Auto Trait Implementations§
impl Freeze for ICU4XLocale
impl RefUnwindSafe for ICU4XLocale
impl Send for ICU4XLocale
impl Sync for ICU4XLocale
impl Unpin for ICU4XLocale
impl UnwindSafe for ICU4XLocale
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more