Struct icu_capi::locale::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>, 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
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> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
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