| 1 |
import { FFIError } from "./diplomat-runtime" |
| 2 |
import { ICU4XDataProvider } from "./ICU4XDataProvider"; |
| 3 |
import { ICU4XError } from "./ICU4XError"; |
| 4 |
import { ICU4XMeasureUnit } from "./ICU4XMeasureUnit"; |
| 5 |
import { ICU4XMeasureUnitParser } from "./ICU4XMeasureUnitParser"; |
| 6 |
import { ICU4XUnitsConverter } from "./ICU4XUnitsConverter"; |
| 7 |
|
| 8 |
/** |
| 9 |
|
| 10 |
* An ICU4X Units Converter Factory object, capable of creating converters a {@link ICU4XUnitsConverter `ICU4XUnitsConverter`} for converting between two {@link ICU4XMeasureUnit `ICU4XMeasureUnit`}s. Also, it can parse the CLDR unit identifier (e.g. `meter-per-square-second`) and get the {@link ICU4XMeasureUnit `ICU4XMeasureUnit`}. |
| 11 |
|
| 12 |
* See the {@link https://docs.rs/icu/latest/icu/experimental/units/converter_factory/struct.ConverterFactory.html Rust documentation for `ConverterFactory`} for more information. |
| 13 |
*/ |
| 14 |
export class ICU4XUnitsConverterFactory { |
| 15 |
|
| 16 |
/** |
| 17 |
|
| 18 |
* Construct a new {@link ICU4XUnitsConverterFactory `ICU4XUnitsConverterFactory`} instance. |
| 19 |
|
| 20 |
* See the {@link https://docs.rs/icu/latest/icu/experimental/units/converter_factory/struct.ConverterFactory.html#method.new Rust documentation for `new`} for more information. |
| 21 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 22 |
*/ |
| 23 |
static create(provider: ICU4XDataProvider): ICU4XUnitsConverterFactory | never; |
| 24 |
|
| 25 |
/** |
| 26 |
|
| 27 |
* Creates a new {@link ICU4XUnitsConverter `ICU4XUnitsConverter`} from the input and output {@link ICU4XMeasureUnit `ICU4XMeasureUnit`}s. Returns nothing if the conversion between the two units is not possible. For example, conversion between `meter` and `second` is not possible. |
| 28 |
|
| 29 |
* See the {@link https://docs.rs/icu/latest/icu/experimental/units/converter_factory/struct.ConverterFactory.html#method.converter Rust documentation for `converter`} for more information. |
| 30 |
*/ |
| 31 |
converter(from: ICU4XMeasureUnit, to: ICU4XMeasureUnit): ICU4XUnitsConverter | undefined; |
| 32 |
|
| 33 |
/** |
| 34 |
|
| 35 |
* Creates a parser to parse the CLDR unit identifier (e.g. `meter-per-square-second`) and get the {@link ICU4XMeasureUnit `ICU4XMeasureUnit`}. |
| 36 |
|
| 37 |
* See the {@link https://docs.rs/icu/latest/icu/experimental/units/converter_factory/struct.ConverterFactory.html#method.parser Rust documentation for `parser`} for more information. |
| 38 |
*/ |
| 39 |
parser(): ICU4XMeasureUnitParser; |
| 40 |
} |