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: DataProvider<DecimalSymbolsV1Marker> + ?Sized>(
data_provider: &D,
locale: &DataLocale,
options: FixedDecimalFormatterOptions
) -> Result<Self, DecimalError>
pub fn try_new_unstable<D: DataProvider<DecimalSymbolsV1Marker> + ?Sized>( data_provider: &D, locale: &DataLocale, options: FixedDecimalFormatterOptions ) -> Result<Self, DecimalError>
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 + ?Sized,
locale: &DataLocale,
options: FixedDecimalFormatterOptions
) -> Result<Self, DecimalError>
pub fn try_new_with_any_provider( provider: &impl AnyProvider + ?Sized, locale: &DataLocale, options: FixedDecimalFormatterOptions ) -> Result<Self, 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 + ?Sized,
locale: &DataLocale,
options: FixedDecimalFormatterOptions
) -> Result<Self, DecimalError>
pub fn try_new_with_buffer_provider( provider: &impl BufferProvider + ?Sized, locale: &DataLocale, options: FixedDecimalFormatterOptions ) -> Result<Self, 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
.