Enum icu::decimal::options::GroupingStrategy[][src]

#[non_exhaustive]
pub enum GroupingStrategy {
    Auto,
    Never,
    Always,
    Min2,
}

Configuration for how often to render grouping separators.

Examples

use icu_decimal::FixedDecimalFormat;
use icu_decimal::FormattedFixedDecimal;
use icu_decimal::options;
use icu_locid::Locale;
use writeable::Writeable;

let locale: Locale = Locale::und().into();
let provider = icu_provider::inv::InvariantDataProvider;
let mut options: options::FixedDecimalFormatOptions = Default::default();
options.grouping_strategy = options::GroupingStrategy::Min2;
let fdf = FixedDecimalFormat::try_new(locale, &provider, options)
    .expect("Data should load successfully");

let one_thousand = 1000.into();
assert_eq!("1000", fdf.format(&one_thousand).writeable_to_string());

let ten_thousand = 10000.into();
assert_eq!("10,000", fdf.format(&ten_thousand).writeable_to_string());

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Auto

Render grouping separators according to locale preferences.

Never

Never render grouping separators.

Always

Always render grouping separators.

For FixedDecimalFormat, GroupingStrategy::Always has the same behavior as GroupingStrategy::Auto.

Min2

Render grouping separators only if there are at least 2 digits before the final grouping separator. In most locales, this means that numbers between 1000 and 9999 do not get grouping separators, but numbers 10,000 and above will.

Trait Implementations

impl Clone for GroupingStrategy[src]

impl Copy for GroupingStrategy[src]

impl Debug for GroupingStrategy[src]

impl Default for GroupingStrategy[src]

impl Eq for GroupingStrategy[src]

impl PartialEq<GroupingStrategy> for GroupingStrategy[src]

impl StructuralEq for GroupingStrategy[src]

impl StructuralPartialEq for GroupingStrategy[src]

Auto Trait Implementations

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> ErasedDataStruct for T where
    T: Clone + Debug + Any

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