| 1 |
import { FFIError } from "./diplomat-runtime" |
| 2 |
import { ICU4XDataProvider } from "./ICU4XDataProvider"; |
| 3 |
import { ICU4XDataStruct } from "./ICU4XDataStruct"; |
| 4 |
import { ICU4XError } from "./ICU4XError"; |
| 5 |
import { ICU4XFixedDecimal } from "./ICU4XFixedDecimal"; |
| 6 |
import { ICU4XFixedDecimalGroupingStrategy } from "./ICU4XFixedDecimalGroupingStrategy"; |
| 7 |
import { ICU4XLocale } from "./ICU4XLocale"; |
| 8 |
|
| 9 |
/** |
| 10 |
|
| 11 |
* An ICU4X Fixed Decimal Format object, capable of formatting a {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} as a string. |
| 12 |
|
| 13 |
* See the {@link https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html Rust documentation for `FixedDecimalFormatter`} for more information. |
| 14 |
*/ |
| 15 |
export class ICU4XFixedDecimalFormatter { |
| 16 |
|
| 17 |
/** |
| 18 |
|
| 19 |
* Creates a new {@link ICU4XFixedDecimalFormatter `ICU4XFixedDecimalFormatter`} from locale data. |
| 20 |
|
| 21 |
* See the {@link https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html#method.try_new Rust documentation for `try_new`} for more information. |
| 22 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 23 |
*/ |
| 24 |
static create_with_grouping_strategy(provider: ICU4XDataProvider, locale: ICU4XLocale, grouping_strategy: ICU4XFixedDecimalGroupingStrategy): ICU4XFixedDecimalFormatter | never; |
| 25 |
|
| 26 |
/** |
| 27 |
|
| 28 |
* Creates a new {@link ICU4XFixedDecimalFormatter `ICU4XFixedDecimalFormatter`} from preconstructed locale data in the form of an {@link ICU4XDataStruct `ICU4XDataStruct`} constructed from `ICU4XDataStruct::create_decimal_symbols()`. |
| 29 |
|
| 30 |
* The contents of the data struct will be consumed: if you wish to use the struct again it will have to be reconstructed. Passing a consumed struct to this method will return an error. |
| 31 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 32 |
*/ |
| 33 |
static create_with_decimal_symbols_v1(data_struct: ICU4XDataStruct, grouping_strategy: ICU4XFixedDecimalGroupingStrategy): ICU4XFixedDecimalFormatter | never; |
| 34 |
|
| 35 |
/** |
| 36 |
|
| 37 |
* Formats a {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} to a string. |
| 38 |
|
| 39 |
* See the {@link https://docs.rs/icu/latest/icu/decimal/struct.FixedDecimalFormatter.html#method.format Rust documentation for `format`} for more information. |
| 40 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 41 |
*/ |
| 42 |
format(value: ICU4XFixedDecimal): string | never; |
| 43 |
} |