Enum icu::decimal::options::SignDisplay [−][src]
#[non_exhaustive] pub enum SignDisplay { Auto, Never, Always, ExceptZero, Negative, }
Configuration for when to render the minus sign or plus sign.
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.sign_display = options::SignDisplay::ExceptZero; let fdf = FixedDecimalFormat::try_new(locale, &provider, options) .expect("Data should load successfully"); let pos_thousand = 1000.into(); assert_eq!("+1,000", fdf.format(&pos_thousand).writeable_to_string()); let zero = 0.into(); assert_eq!("0", fdf.format(&zero).writeable_to_string()); let neg_thousand = (-1000).into(); assert_eq!("-1,000", fdf.format(&neg_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.
Render the sign according to locale preferences. In most cases, this means a minus sign will be shown on negative numbers, and no sign will be shown on positive numbers.
Do not display the sign. Positive and negative numbers are indistinguishable.
Show a minus sign on negative numbers and a plus sign on positive numbers, including zero.
Show a minus sign on negative numbers and a plus sign on positive numbers, except do not show any sign on positive or negative zero.
Show a minus sign on strictly negative numbers. Do not show a sign on positive numbers or on positive or negative zero.
This differs from Auto
in that it does not render a sign on negative zero.
Trait Implementations
impl Clone for SignDisplay
[src]
impl Clone for SignDisplay
[src]pub fn clone(&self) -> SignDisplay
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for SignDisplay
[src]
impl Copy for SignDisplay
[src]impl Default for SignDisplay
[src]
impl Default for SignDisplay
[src]pub fn default() -> SignDisplay
[src]
impl Eq for SignDisplay
[src]
impl Eq for SignDisplay
[src]impl PartialEq<SignDisplay> for SignDisplay
[src]
impl PartialEq<SignDisplay> for SignDisplay
[src]impl StructuralEq for SignDisplay
[src]
impl StructuralEq for SignDisplay
[src]impl StructuralPartialEq for SignDisplay
[src]
impl StructuralPartialEq for SignDisplay
[src]Auto Trait Implementations
impl RefUnwindSafe for SignDisplay
impl RefUnwindSafe for SignDisplay
impl Send for SignDisplay
impl Send for SignDisplay
impl Sync for SignDisplay
impl Sync for SignDisplay
impl Unpin for SignDisplay
impl Unpin for SignDisplay
impl UnwindSafe for SignDisplay
impl UnwindSafe for SignDisplay