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

source

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.

source

pub fn create_und() -> Box<ICU4XLocale>

Construct a default undefined ICU4XLocale “und”.

source

pub fn clone(&self) -> Box<ICU4XLocale>

Clones the ICU4XLocale.

source

pub fn basename(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>

Write a string representation of the LanguageIdentifier part of ICU4XLocale to write.

source

pub fn get_unicode_extension( &self, bytes: &DiplomatStr, write: &mut DiplomatWriteable, ) -> Result<(), ICU4XError>

Write a string representation of the unicode extension to write

source

pub fn language(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>

Write a string representation of ICU4XLocale language to write

source

pub fn set_language(&mut self, bytes: &DiplomatStr) -> Result<(), ICU4XError>

Set the language part of the ICU4XLocale.

source

pub fn region(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>

Write a string representation of ICU4XLocale region to write

source

pub fn set_region(&mut self, bytes: &DiplomatStr) -> Result<(), ICU4XError>

Set the region part of the ICU4XLocale.

source

pub fn script(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>

Write a string representation of ICU4XLocale script to write

source

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.

source

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

source

pub fn to_string(&self, write: &mut DiplomatWriteable) -> Result<(), ICU4XError>

Write a string representation of ICU4XLocale to write

source

pub fn normalizing_eq(&self, other: &DiplomatStr) -> bool

source

pub fn strict_cmp(&self, other: &DiplomatStr) -> ICU4XOrdering

source

pub fn strict_cmp_(&self, other: &DiplomatStr) -> Ordering

source

pub fn total_cmp(&self, other: &Self) -> ICU4XOrdering

source

pub fn total_cmp_(&self, other: &Self) -> Ordering

source§

impl ICU4XLocale

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Filterable for T

source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T