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.
📏 This item has a stack size of 88 bytes on the stable toolchain at release date.
Implementations§
source§impl FixedDecimalFormatter
impl FixedDecimalFormatter
sourcepub fn try_new(
locale: &DataLocale,
options: FixedDecimalFormatterOptions,
) -> Result<FixedDecimalFormatter, DataError>
pub fn try_new( locale: &DataLocale, options: FixedDecimalFormatterOptions, ) -> Result<FixedDecimalFormatter, DataError>
Creates a new FixedDecimalFormatter
from compiled data and an options bag.
✨ Enabled with the compiled_data
Cargo feature.
sourcepub fn try_new_with_any_provider(
provider: &(impl AnyProvider + ?Sized),
locale: &DataLocale,
options: FixedDecimalFormatterOptions,
) -> Result<FixedDecimalFormatter, DataError>
pub fn try_new_with_any_provider( provider: &(impl AnyProvider + ?Sized), locale: &DataLocale, options: FixedDecimalFormatterOptions, ) -> Result<FixedDecimalFormatter, DataError>
A version of [Self :: try_new
] that uses custom data provided by an AnyProvider
.
sourcepub fn try_new_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
locale: &DataLocale,
options: FixedDecimalFormatterOptions,
) -> Result<FixedDecimalFormatter, DataError>
pub fn try_new_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), locale: &DataLocale, options: FixedDecimalFormatterOptions, ) -> Result<FixedDecimalFormatter, DataError>
A version of [Self :: try_new
] that uses custom data provided by a BufferProvider
.
✨ Enabled with the serde
feature.
sourcepub fn try_new_unstable<D>(
provider: &D,
locale: &DataLocale,
options: FixedDecimalFormatterOptions,
) -> Result<FixedDecimalFormatter, DataError>
pub fn try_new_unstable<D>( provider: &D, locale: &DataLocale, options: FixedDecimalFormatterOptions, ) -> Result<FixedDecimalFormatter, DataError>
A version of Self::try_new
that uses custom data provided by a DataProvider
.
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
.
Trait Implementations§
source§impl AsRef<FixedDecimalFormatter> for FixedDecimalFormatter
impl AsRef<FixedDecimalFormatter> for FixedDecimalFormatter
source§fn as_ref(&self) -> &FixedDecimalFormatter
fn as_ref(&self) -> &FixedDecimalFormatter
Auto Trait Implementations§
impl Freeze for FixedDecimalFormatter
impl RefUnwindSafe for FixedDecimalFormatter
impl Send for FixedDecimalFormatter
impl Sync for FixedDecimalFormatter
impl Unpin for FixedDecimalFormatter
impl UnwindSafe for FixedDecimalFormatter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more