Enum num_format::Locale

source ·
pub enum Locale {
Show 542 variants af, af_NA, agq, ak, am, ar, ar_AE, ar_BH, ar_DJ, ar_DZ, ar_EG, ar_EH, ar_ER, ar_IL, ar_IQ, ar_JO, ar_KM, ar_KW, ar_LB, ar_LY, ar_MA, ar_MR, ar_OM, ar_PS, ar_QA, ar_SA, ar_SD, ar_SO, ar_SS, ar_SY, ar_TD, ar_TN, ar_YE, as_, asa, ast, az, az_Cyrl, az_Latn, bas, be, bem, bez, bg, bm, bn, bn_IN, bo, bo_IN, br, brx, bs, bs_Cyrl, bs_Latn, ca, ca_AD, ca_ES_VALENCIA, ca_FR, ca_IT, ccp, ccp_IN, ce, ceb, cgg, chr, ckb, ckb_IR, cs, cu, cy, da, da_GL, dav, de, de_AT, de_BE, de_CH, de_IT, de_LI, de_LU, dje, dsb, dua, dyo, dz, ebu, ee, ee_TG, el, el_CY, en, en_001, en_150, en_AE, en_AG, en_AI, en_AS, en_AT, en_AU, en_BB, en_BE, en_BI, en_BM, en_BS, en_BW, en_BZ, en_CA, en_CC, en_CH, en_CK, en_CM, en_CX, en_CY, en_DE, en_DG, en_DK, en_DM, en_ER, en_FI, en_FJ, en_FK, en_FM, en_GB, en_GD, en_GG, en_GH, en_GI, en_GM, en_GU, en_GY, en_HK, en_IE, en_IL, en_IM, en_IN, en_IO, en_JE, en_JM, en_KE, en_KI, en_KN, en_KY, en_LC, en_LR, en_LS, en_MG, en_MH, en_MO, en_MP, en_MS, en_MT, en_MU, en_MW, en_MY, en_NA, en_NF, en_NG, en_NL, en_NR, en_NU, en_NZ, en_PG, en_PH, en_PK, en_PN, en_PR, en_PW, en_RW, en_SB, en_SC, en_SD, en_SE, en_SG, en_SH, en_SI, en_SL, en_SS, en_SX, en_SZ, en_TC, en_TK, en_TO, en_TT, en_TV, en_TZ, en_UG, en_UM, en_US_POSIX, en_VC, en_VG, en_VI, en_VU, en_WS, en_ZA, en_ZM, en_ZW, eo, es, es_419, es_AR, es_BO, es_BR, es_BZ, es_CL, es_CO, es_CR, es_CU, es_DO, es_EA, es_EC, es_GQ, es_GT, es_HN, es_IC, es_MX, es_NI, es_PA, es_PE, es_PH, es_PR, es_PY, es_SV, es_US, es_UY, es_VE, et, eu, ewo, fa, fa_AF, ff, ff_Latn, ff_Latn_BF, ff_Latn_CM, ff_Latn_GH, ff_Latn_GM, ff_Latn_GN, ff_Latn_GW, ff_Latn_LR, ff_Latn_MR, ff_Latn_NE, ff_Latn_NG, ff_Latn_SL, fi, fil, fo, fo_DK, fr, fr_BE, fr_BF, fr_BI, fr_BJ, fr_BL, fr_CA, fr_CD, fr_CF, fr_CG, fr_CH, fr_CI, fr_CM, fr_DJ, fr_DZ, fr_GA, fr_GF, fr_GN, fr_GP, fr_GQ, fr_HT, fr_KM, fr_LU, fr_MA, fr_MC, fr_MF, fr_MG, fr_ML, fr_MQ, fr_MR, fr_MU, fr_NC, fr_NE, fr_PF, fr_PM, fr_RE, fr_RW, fr_SC, fr_SN, fr_SY, fr_TD, fr_TG, fr_TN, fr_VU, fr_WF, fr_YT, fur, fy, ga, ga_GB, gd, gl, gsw, gsw_FR, gsw_LI, gu, guz, gv, ha, ha_GH, ha_NE, haw, he, hi, hr, hr_BA, hsb, hu, hy, ia, id, ig, ii, is, it, it_CH, it_SM, it_VA, ja, jgo, jmc, jv, ka, kab, kam, kde, kea, khq, ki, kk, kkj, kl, kln, km, kn, ko, ko_KP, kok, ks, ksb, ksf, ksh, ku, kw, ky, lag, lb, lg, lkt, ln, ln_AO, ln_CF, ln_CG, lo, lrc, lrc_IQ, lt, lu, luo, luy, lv, mas, mas_TZ, mer, mfe, mg, mgh, mgo, mi, mk, ml, mn, mr, ms, ms_BN, ms_SG, mt, mua, my, mzn, naq, nb, nb_SJ, nd, nds, nds_NL, ne, ne_IN, nl, nl_AW, nl_BE, nl_BQ, nl_CW, nl_SR, nl_SX, nmg, nn, nnh, nus, nyn, om, om_KE, or, os, os_RU, pa, pa_Arab, pa_Guru, pl, prg, ps, ps_PK, pt, pt_AO, pt_CH, pt_CV, pt_GQ, pt_GW, pt_LU, pt_MO, pt_MZ, pt_PT, pt_ST, pt_TL, qu, qu_BO, qu_EC, rm, rn, ro, ro_MD, rof, root, ru, ru_BY, ru_KG, ru_KZ, ru_MD, ru_UA, rw, rwk, sah, saq, sbp, sd, se, se_FI, se_SE, seh, ses, sg, shi, shi_Latn, shi_Tfng, si, sk, sl, smn, sn, so, so_DJ, so_ET, so_KE, sq, sq_MK, sq_XK, sr, sr_Cyrl, sr_Cyrl_BA, sr_Cyrl_ME, sr_Cyrl_XK, sr_Latn, sr_Latn_BA, sr_Latn_ME, sr_Latn_XK, sv, sv_AX, sv_FI, sw, sw_CD, sw_KE, sw_UG, ta, ta_LK, ta_MY, ta_SG, te, teo, teo_KE, tg, th, ti, ti_ER, tk, to, tr, tr_CY, tt, twq, tzm, ug, uk, ur, ur_IN, uz, uz_Arab, uz_Cyrl, uz_Latn, vai, vai_Latn, vai_Vaii, vi, vo, vun, wae, wo, xh, xog, yav, yi, yo, yo_BJ, yue, yue_Hans, yue_Hant, zgh, zh, zh_Hans, zh_Hans_HK, zh_Hans_MO, zh_Hans_SG, zh_Hant, zh_Hant_HK, zh_Hant_MO, zu,
}
Expand description

A key type. Represents formats from the Unicode Consortium’s Common Locale Data Repository (CLDR). Implements Format.

Example

use num_format::{Buffer, Locale};

fn main() {
    // Using the French format from the Unicode Common Locale Data Repository...
    let mut buf = Buffer::new();
    buf.write_formatted(&(-1000000), &Locale::fr);
    assert_eq!("-1\u{202f}000\u{202f}000", buf.as_str());

    // Note:
    // U+202F is the "NARROW NO-BREAK SPACE" code point.
    // When displayed to the screen, it looks like a space.
}

Variants§

§

af

§

af_NA

§

agq

§

ak

§

am

§

ar

§

ar_AE

§

ar_BH

§

ar_DJ

§

ar_DZ

§

ar_EG

§

ar_EH

§

ar_ER

§

ar_IL

§

ar_IQ

§

ar_JO

§

ar_KM

§

ar_KW

§

ar_LB

§

ar_LY

§

ar_MA

§

ar_MR

§

ar_OM

§

ar_PS

§

ar_QA

§

ar_SA

§

ar_SD

§

ar_SO

§

ar_SS

§

ar_SY

§

ar_TD

§

ar_TN

§

ar_YE

§

as_

§

asa

§

ast

§

az

§

az_Cyrl

§

az_Latn

§

bas

§

be

§

bem

§

bez

§

bg

§

bm

§

bn

§

bn_IN

§

bo

§

bo_IN

§

br

§

brx

§

bs

§

bs_Cyrl

§

bs_Latn

§

ca

§

ca_AD

§

ca_ES_VALENCIA

§

ca_FR

§

ca_IT

§

ccp

§

ccp_IN

§

ce

§

ceb

§

cgg

§

chr

§

ckb

§

ckb_IR

§

cs

§

cu

§

cy

§

da

§

da_GL

§

dav

§

de

§

de_AT

§

de_BE

§

de_CH

§

de_IT

§

de_LI

§

de_LU

§

dje

§

dsb

§

dua

§

dyo

§

dz

§

ebu

§

ee

§

ee_TG

§

el

§

el_CY

§

en

§

en_001

§

en_150

§

en_AE

§

en_AG

§

en_AI

§

en_AS

§

en_AT

§

en_AU

§

en_BB

§

en_BE

§

en_BI

§

en_BM

§

en_BS

§

en_BW

§

en_BZ

§

en_CA

§

en_CC

§

en_CH

§

en_CK

§

en_CM

§

en_CX

§

en_CY

§

en_DE

§

en_DG

§

en_DK

§

en_DM

§

en_ER

§

en_FI

§

en_FJ

§

en_FK

§

en_FM

§

en_GB

§

en_GD

§

en_GG

§

en_GH

§

en_GI

§

en_GM

§

en_GU

§

en_GY

§

en_HK

§

en_IE

§

en_IL

§

en_IM

§

en_IN

§

en_IO

§

en_JE

§

en_JM

§

en_KE

§

en_KI

§

en_KN

§

en_KY

§

en_LC

§

en_LR

§

en_LS

§

en_MG

§

en_MH

§

en_MO

§

en_MP

§

en_MS

§

en_MT

§

en_MU

§

en_MW

§

en_MY

§

en_NA

§

en_NF

§

en_NG

§

en_NL

§

en_NR

§

en_NU

§

en_NZ

§

en_PG

§

en_PH

§

en_PK

§

en_PN

§

en_PR

§

en_PW

§

en_RW

§

en_SB

§

en_SC

§

en_SD

§

en_SE

§

en_SG

§

en_SH

§

en_SI

§

en_SL

§

en_SS

§

en_SX

§

en_SZ

§

en_TC

§

en_TK

§

en_TO

§

en_TT

§

en_TV

§

en_TZ

§

en_UG

§

en_UM

§

en_US_POSIX

§

en_VC

§

en_VG

§

en_VI

§

en_VU

§

en_WS

§

en_ZA

§

en_ZM

§

en_ZW

§

eo

§

es

§

es_419

§

es_AR

§

es_BO

§

es_BR

§

es_BZ

§

es_CL

§

es_CO

§

es_CR

§

es_CU

§

es_DO

§

es_EA

§

es_EC

§

es_GQ

§

es_GT

§

es_HN

§

es_IC

§

es_MX

§

es_NI

§

es_PA

§

es_PE

§

es_PH

§

es_PR

§

es_PY

§

es_SV

§

es_US

§

es_UY

§

es_VE

§

et

§

eu

§

ewo

§

fa

§

fa_AF

§

ff

§

ff_Latn

§

ff_Latn_BF

§

ff_Latn_CM

§

ff_Latn_GH

§

ff_Latn_GM

§

ff_Latn_GN

§

ff_Latn_GW

§

ff_Latn_LR

§

ff_Latn_MR

§

ff_Latn_NE

§

ff_Latn_NG

§

ff_Latn_SL

§

fi

§

fil

§

fo

§

fo_DK

§

fr

§

fr_BE

§

fr_BF

§

fr_BI

§

fr_BJ

§

fr_BL

§

fr_CA

§

fr_CD

§

fr_CF

§

fr_CG

§

fr_CH

§

fr_CI

§

fr_CM

§

fr_DJ

§

fr_DZ

§

fr_GA

§

fr_GF

§

fr_GN

§

fr_GP

§

fr_GQ

§

fr_HT

§

fr_KM

§

fr_LU

§

fr_MA

§

fr_MC

§

fr_MF

§

fr_MG

§

fr_ML

§

fr_MQ

§

fr_MR

§

fr_MU

§

fr_NC

§

fr_NE

§

fr_PF

§

fr_PM

§

fr_RE

§

fr_RW

§

fr_SC

§

fr_SN

§

fr_SY

§

fr_TD

§

fr_TG

§

fr_TN

§

fr_VU

§

fr_WF

§

fr_YT

§

fur

§

fy

§

ga

§

ga_GB

§

gd

§

gl

§

gsw

§

gsw_FR

§

gsw_LI

§

gu

§

guz

§

gv

§

ha

§

ha_GH

§

ha_NE

§

haw

§

he

§

hi

§

hr

§

hr_BA

§

hsb

§

hu

§

hy

§

ia

§

id

§

ig

§

ii

§

is

§

it

§

it_CH

§

it_SM

§

it_VA

§

ja

§

jgo

§

jmc

§

jv

§

ka

§

kab

§

kam

§

kde

§

kea

§

khq

§

ki

§

kk

§

kkj

§

kl

§

kln

§

km

§

kn

§

ko

§

ko_KP

§

kok

§

ks

§

ksb

§

ksf

§

ksh

§

ku

§

kw

§

ky

§

lag

§

lb

§

lg

§

lkt

§

ln

§

ln_AO

§

ln_CF

§

ln_CG

§

lo

§

lrc

§

lrc_IQ

§

lt

§

lu

§

luo

§

luy

§

lv

§

mas

§

mas_TZ

§

mer

§

mfe

§

mg

§

mgh

§

mgo

§

mi

§

mk

§

ml

§

mn

§

mr

§

ms

§

ms_BN

§

ms_SG

§

mt

§

mua

§

my

§

mzn

§

naq

§

nb

§

nb_SJ

§

nd

§

nds

§

nds_NL

§

ne

§

ne_IN

§

nl

§

nl_AW

§

nl_BE

§

nl_BQ

§

nl_CW

§

nl_SR

§

nl_SX

§

nmg

§

nn

§

nnh

§

nus

§

nyn

§

om

§

om_KE

§

or

§

os

§

os_RU

§

pa

§

pa_Arab

§

pa_Guru

§

pl

§

prg

§

ps

§

ps_PK

§

pt

§

pt_AO

§

pt_CH

§

pt_CV

§

pt_GQ

§

pt_GW

§

pt_LU

§

pt_MO

§

pt_MZ

§

pt_PT

§

pt_ST

§

pt_TL

§

qu

§

qu_BO

§

qu_EC

§

rm

§

rn

§

ro

§

ro_MD

§

rof

§

root

§

ru

§

ru_BY

§

ru_KG

§

ru_KZ

§

ru_MD

§

ru_UA

§

rw

§

rwk

§

sah

§

saq

§

sbp

§

sd

§

se

§

se_FI

§

se_SE

§

seh

§

ses

§

sg

§

shi

§

shi_Latn

§

shi_Tfng

§

si

§

sk

§

sl

§

smn

§

sn

§

so

§

so_DJ

§

so_ET

§

so_KE

§

sq

§

sq_MK

§

sq_XK

§

sr

§

sr_Cyrl

§

sr_Cyrl_BA

§

sr_Cyrl_ME

§

sr_Cyrl_XK

§

sr_Latn

§

sr_Latn_BA

§

sr_Latn_ME

§

sr_Latn_XK

§

sv

§

sv_AX

§

sv_FI

§

sw

§

sw_CD

§

sw_KE

§

sw_UG

§

ta

§

ta_LK

§

ta_MY

§

ta_SG

§

te

§

teo

§

teo_KE

§

tg

§

th

§

ti

§

ti_ER

§

tk

§

to

§

tr

§

tr_CY

§

tt

§

twq

§

tzm

§

ug

§

uk

§

ur

§

ur_IN

§

uz

§

uz_Arab

§

uz_Cyrl

§

uz_Latn

§

vai

§

vai_Latn

§

vai_Vaii

§

vi

§

vo

§

vun

§

wae

§

wo

§

xh

§

xog

§

yav

§

yi

§

yo

§

yo_BJ

§

yue

§

yue_Hans

§

yue_Hant

§

zgh

§

zh

§

zh_Hans

§

zh_Hans_HK

§

zh_Hans_MO

§

zh_Hans_SG

§

zh_Hant

§

zh_Hant_HK

§

zh_Hant_MO

§

zu

Implementations§

source§

impl Locale

source

pub fn from_name<S>(name: S) -> Result<Locale, Error>where S: AsRef<str>,

Constructs a Locale from its name. For a list of available names, see available_names.

Errors

Returns an error if the name provided cannot be parsed into a Locale.

source

pub fn available_names() -> &'static [&'static str]

Returns a static slice of all available names.

source

pub fn decimal(&self) -> &'static str

Returns the locale’s decimal representation.

source

pub fn grouping(&self) -> Grouping

Returns the locale’s Grouping.

source

pub fn infinity(&self) -> &'static str

Returns the locale’s infinity representation.

source

pub fn minus_sign(&self) -> &'static str

Returns the locale’s minus sign representation.

source

pub fn name(&self) -> &'static str

Returns the locale’s name.

source

pub fn nan(&self) -> &'static str

Returns the locale’s NaN representation.

source

pub fn plus_sign(&self) -> &'static str

Returns the locale’s plus sign representation.

source

pub fn separator(&self) -> &'static str

Returns the locale’s separator representation, if any.

Trait Implementations§

source§

impl Clone for Locale

source§

fn clone(&self) -> Locale

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Locale

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Format for Locale

source§

fn decimal(&self) -> DecimalStr<'_>

Returns the string representation of a decimal point.
source§

fn grouping(&self) -> Grouping

Returns the Grouping to use for separating digits. (see Grouping)
source§

fn infinity(&self) -> InfinityStr<'_>

Returns the string representation of an infinity symbol.
source§

fn minus_sign(&self) -> MinusSignStr<'_>

Returns the string representation of a minus sign.
source§

fn nan(&self) -> NanStr<'_>

Returns the string representation of NaN.
source§

fn plus_sign(&self) -> PlusSignStr<'_>

Returns the string representation of a plus sign.
source§

fn separator(&self) -> SeparatorStr<'_>

Returns the string representation of a thousands separator.
source§

impl From<Locale> for CustomFormat

source§

fn from(locale: Locale) -> Self

Converts to this type from the input type.
source§

impl From<Locale> for CustomFormatBuilder

source§

fn from(locale: Locale) -> Self

Converts to this type from the input type.
source§

impl FromStr for Locale

source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Same as from_name.

§

type Err = Error

The associated error which can be returned from parsing.
source§

impl Hash for Locale

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Locale

source§

fn cmp(&self, other: &Locale) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Locale> for Locale

source§

fn eq(&self, other: &Locale) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Locale> for Locale

source§

fn partial_cmp(&self, other: &Locale) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for Locale

source§

impl Eq for Locale

source§

impl StructuralEq for Locale

source§

impl StructuralPartialEq for Locale

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.