num_format/format.rs
1use crate::strings::{DecimalStr, InfinityStr, MinusSignStr, NanStr, PlusSignStr, SeparatorStr};
2use crate::Grouping;
3
4/// Trait that abstracts over [`CustomFormat`], [`Locale`], and `SystemLocale`.
5///
6/// [`CustomFormat`]: struct.CustomFormat.html
7/// [`Locale`]: enum.Locale.html
8pub trait Format {
9 /// Returns the string representation of a decimal point.
10 fn decimal(&self) -> DecimalStr<'_>;
11 /// Returns the [`Grouping`] to use for separating digits. (see [`Grouping`])
12 ///
13 /// [`Grouping`]: enum.Grouping.html
14 fn grouping(&self) -> Grouping;
15 /// Returns the string representation of an infinity symbol.
16 fn infinity(&self) -> InfinityStr<'_>;
17 /// Returns the string representation of a minus sign.
18 fn minus_sign(&self) -> MinusSignStr<'_>;
19 /// Returns the string representation of NaN.
20 fn nan(&self) -> NanStr<'_>;
21 /// Returns the string representation of a plus sign.
22 fn plus_sign(&self) -> PlusSignStr<'_>;
23 /// Returns the string representation of a thousands separator.
24 fn separator(&self) -> SeparatorStr<'_>;
25}