[][src]Struct rust_icu_uloc::ULoc

pub struct ULoc { /* fields omitted */ }

A representation of a Unicode locale.

For the time being, only basic conversion and methods are in fact implemented.

To get basic validation when creating a locale, use for_language_tag with a Unicode BCP-47 locale ID.

Implementations

impl ULoc[src]

pub fn language(&self) -> Option<String>[src]

Implements uloc_getLanguage.

pub fn script(&self) -> Option<String>[src]

Implements uloc_getScript.

pub fn country(&self) -> Option<String>[src]

Implements uloc_getCountry.

pub fn variant(&self) -> Option<String>[src]

Implements uloc_getVariant.

pub fn canonicalize(&self) -> Result<ULoc, Error>[src]

Implements uloc_canonicalize from ICU4C.

pub fn add_likely_subtags(&self) -> Result<ULoc, Error>[src]

Implements uloc_addLikelySubtags from ICU4C.

pub fn minimize_subtags(&self) -> Result<ULoc, Error>[src]

Implements uloc_minimizeSubtags from ICU4C.

pub fn to_language_tag(&self, strict: bool) -> Result<String, Error>[src]

Implements uloc_toLanguageTag from ICU4C.

pub fn keywords(&self) -> impl Iterator<Item = String>[src]

Implements uloc_openKeywords() from ICU4C.

pub fn unicode_keywords(&self) -> impl Iterator<Item = String>[src]

Implements icu::Locale::getUnicodeKeywords() from the C++ API.

pub fn keyword_value(&self, keyword: &str) -> Result<Option<String>, Error>[src]

Implements uloc_getKeywordValue() from ICU4C.

pub fn unicode_keyword_value(
    &self,
    unicode_keyword: &str
) -> Result<Option<String>, Error>
[src]

Implements icu::Locale::getUnicodeKeywordValue() from ICU4C.

pub fn label(&self) -> &str[src]

Returns the current label of this locale.

pub fn as_c_str(&self) -> CString[src]

Returns the current locale name as a C string.

pub fn for_language_tag(tag: &str) -> Result<ULoc, Error>[src]

Implements uloc_forLanguageTag from ICU4C.

Trait Implementations

impl Clone for ULoc[src]

impl Debug for ULoc[src]

impl Display for ULoc[src]

Implement the Display trait to convert the ULoc into string for display.

The string for display and string serialization happen to be the same for ULoc.

impl Eq for ULoc[src]

impl Hash for ULoc[src]

impl Locale for ULoc[src]

Marker implementation for ULoc.

impl Ord for ULoc[src]

This implementation is based on ULocale.compareTo from ICU4J. See https://github.com/unicode-org/icu/blob/master/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java

impl PartialEq<ULoc> for ULoc[src]

impl PartialOrd<ULoc> for ULoc[src]

impl StructuralEq for ULoc[src]

impl StructuralPartialEq for ULoc[src]

impl<'_> TryFrom<&'_ CStr> for ULoc[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(s: &CStr) -> Result<Self, Self::Error>[src]

Creates a new ULoc from a borrowed C string.

impl<'_> TryFrom<&'_ str> for ULoc[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(s: &str) -> Result<Self, Self::Error>[src]

Creates a new ULoc from a string slice.

The creation wil fail if the locale is nonexistent.

Auto Trait Implementations

impl RefUnwindSafe for ULoc

impl Send for ULoc

impl Sync for ULoc

impl Unpin for ULoc

impl UnwindSafe for ULoc

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.