Struct icu_capi::locale_core::ffi::Locale

source ·
pub struct Locale(pub Locale);
Expand description

An ICU4X Locale, capable of representing strings like "en-US".

Tuple Fields§

§0: Locale

Implementations§

source§

impl Locale

source

pub fn from_string(name: &DiplomatStr) -> Result<Box<Locale>, LocaleParseError>

Construct an Locale 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 und() -> Box<Locale>

Construct a default undefined Locale “und”.

source

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

Clones the Locale.

source

pub fn basename(&self, write: &mut DiplomatWrite)

Returns a string representation of the LanguageIdentifier part of Locale.

source

pub fn get_unicode_extension( &self, s: &DiplomatStr, write: &mut DiplomatWrite, ) -> Option<()>

Returns a string representation of the unicode extension.

source

pub fn language(&self, write: &mut DiplomatWrite)

Returns a string representation of Locale language.

source

pub fn set_language(&mut self, s: &DiplomatStr) -> Result<(), LocaleParseError>

Set the language part of the Locale.

source

pub fn region(&self, write: &mut DiplomatWrite) -> Option<()>

Returns a string representation of Locale region.

source

pub fn set_region(&mut self, s: &DiplomatStr) -> Result<(), LocaleParseError>

Set the region part of the Locale.

source

pub fn script(&self, write: &mut DiplomatWrite) -> Option<()>

Returns a string representation of Locale script.

source

pub fn set_script(&mut self, s: &DiplomatStr) -> Result<(), LocaleParseError>

Set the script part of the Locale. Pass an empty string to remove the script.

source

pub fn normalize( s: &DiplomatStr, write: &mut DiplomatWrite, ) -> Result<(), LocaleParseError>

Normalizes a locale string.

source

pub fn to_string(&self, write: &mut DiplomatWrite)

Returns a string representation of Locale.

source

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

source

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

source

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

source§

impl Locale

Trait Implementations§

source§

impl<'a> From<&'a Locale> for SentenceBreakOptions<'a>

source§

fn from(other: &'a Locale) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a Locale> for WordBreakOptions<'a>

source§

fn from(other: &'a Locale) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Locale

§

impl RefUnwindSafe for Locale

§

impl Send for Locale

§

impl Sync for Locale

§

impl Unpin for Locale

§

impl UnwindSafe for Locale

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

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
where T: Send + Sync,