Struct icu::decimal::FixedDecimalFormatter
source · pub struct FixedDecimalFormatter { /* private fields */ }
Expand description
A formatter for [FixedDecimal
], rendering decimal digits in an i18n-friendly way.
FixedDecimalFormatter
supports:
- Rendering in the local numbering system
- Locale-sensitive grouping separator positions
- Locale-sensitive plus and minus signs
Read more about the options in the options
module.
See the crate-level documentation for examples.
Implementations§
source§impl FixedDecimalFormatter
impl FixedDecimalFormatter
sourcepub fn try_new_unstable<D>(
data_provider: &D,
locale: &DataLocale,
options: FixedDecimalFormatterOptions
) -> Result<FixedDecimalFormatter, DecimalError>where
D: DataProvider<DecimalSymbolsV1Marker> + ?Sized,
pub fn try_new_unstable<D>( data_provider: &D, locale: &DataLocale, options: FixedDecimalFormatterOptions ) -> Result<FixedDecimalFormatter, DecimalError>where D: DataProvider<DecimalSymbolsV1Marker> + ?Sized,
Creates a new FixedDecimalFormatter
from locale data and an options bag.
⚠️ The bounds on this function may change over time, including in SemVer minor releases.
sourcepub fn try_new_with_any_provider(
provider: &impl AnyProvider,
locale: &DataLocale,
options: FixedDecimalFormatterOptions
) -> Result<FixedDecimalFormatter, DecimalError>
pub fn try_new_with_any_provider( provider: &impl AnyProvider, locale: &DataLocale, options: FixedDecimalFormatterOptions ) -> Result<FixedDecimalFormatter, DecimalError>
Creates a new instance using an AnyProvider
.
For details on the behavior of this function, see: Self::try_new_unstable
sourcepub fn try_new_with_buffer_provider(
provider: &impl BufferProvider,
locale: &DataLocale,
options: FixedDecimalFormatterOptions
) -> Result<FixedDecimalFormatter, DecimalError>
pub fn try_new_with_buffer_provider( provider: &impl BufferProvider, locale: &DataLocale, options: FixedDecimalFormatterOptions ) -> Result<FixedDecimalFormatter, DecimalError>
✨ Enabled with the "serde"
feature.
Creates a new instance using a BufferProvider
.
For details on the behavior of this function, see: Self::try_new_unstable
sourcepub fn format<'l>(
&'l self,
value: &'l FixedDecimal
) -> FormattedFixedDecimal<'l>
pub fn format<'l>( &'l self, value: &'l FixedDecimal ) -> FormattedFixedDecimal<'l>
Formats a [FixedDecimal
], returning a FormattedFixedDecimal
.
sourcepub fn format_to_string(&self, value: &FixedDecimal) -> String
pub fn format_to_string(&self, value: &FixedDecimal) -> String
Formats a [FixedDecimal
], returning a String
.