Enum num_format::Locale [−][src]
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
Implementations
impl Locale
[src]
pub fn from_name<S>(name: S) -> Result<Locale, Error> where
S: AsRef<str>,
[src]
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
.
pub fn available_names() -> &'static [&'static str]
[src]
Returns a static slice of all available names.
pub fn decimal(&self) -> &'static str
[src]
Returns the locale’s decimal representation.
pub fn grouping(&self) -> Grouping
[src]
Returns the locale’s Grouping
.
pub fn infinity(&self) -> &'static str
[src]
Returns the locale’s infinity representation.
pub fn minus_sign(&self) -> &'static str
[src]
Returns the locale’s minus sign representation.
pub fn name(&self) -> &'static str
[src]
Returns the locale’s name.
pub fn nan(&self) -> &'static str
[src]
Returns the locale’s NaN representation.
pub fn plus_sign(&self) -> &'static str
[src]
Returns the locale’s plus sign representation.
pub fn separator(&self) -> &'static str
[src]
Returns the locale’s separator representation, if any.
Trait Implementations
impl Clone for Locale
[src]
impl Copy for Locale
[src]
impl Debug for Locale
[src]
impl Eq for Locale
[src]
impl Format for Locale
[src]
fn decimal(&self) -> DecimalStr<'_>
[src]
fn grouping(&self) -> Grouping
[src]
fn infinity(&self) -> InfinityStr<'_>
[src]
fn minus_sign(&self) -> MinusSignStr<'_>
[src]
fn nan(&self) -> NanStr<'_>
[src]
fn plus_sign(&self) -> PlusSignStr<'_>
[src]
fn separator(&self) -> SeparatorStr<'_>
[src]
impl From<Locale> for CustomFormat
[src]
impl From<Locale> for CustomFormatBuilder
[src]
impl FromStr for Locale
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
Same as from_name
.
impl Hash for Locale
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Locale
[src]
fn cmp(&self, other: &Locale) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Locale> for Locale
[src]
impl PartialOrd<Locale> for Locale
[src]
fn partial_cmp(&self, other: &Locale) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Locale
[src]
impl StructuralPartialEq for Locale
[src]
Auto Trait Implementations
impl RefUnwindSafe for Locale
impl Send for Locale
impl Sync for Locale
impl Unpin for Locale
impl UnwindSafe for Locale
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,