ICU4XLocale

Struct 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 168 bytes