UnitsConverterFactory.d.ts (1728B)
1 // generated by diplomat-tool 2 import type { DataError } from "./DataError" 3 import type { DataProvider } from "./DataProvider" 4 import type { MeasureUnit } from "./MeasureUnit" 5 import type { UnitsConverter } from "./UnitsConverter" 6 import type { pointer, codepoint } from "./diplomat-runtime.d.ts"; 7 8 9 /** 10 * An ICU4X Units Converter Factory object, capable of creating converters a [`UnitsConverter`] 11 * for converting between two [`MeasureUnit`]s. 12 * 13 * Also, it can parse the CLDR unit identifier (e.g. `meter-per-square-second`) and get the [`MeasureUnit`]. 14 * 15 * See the [Rust documentation for `ConverterFactory`](https://docs.rs/icu/latest/icu/experimental/units/converter_factory/struct.ConverterFactory.html) for more information. 16 */ 17 18 19 export class UnitsConverterFactory { 20 get ffiValue(): pointer; 21 22 23 /** 24 * Construct a new [`UnitsConverterFactory`] instance using a particular data source. 25 * 26 * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/experimental/units/converter_factory/struct.ConverterFactory.html#method.new) for more information. 27 */ 28 static createWithProvider(provider: DataProvider): UnitsConverterFactory; 29 30 /** 31 * Creates a new [`UnitsConverter`] from the input and output [`MeasureUnit`]s. 32 * Returns nothing if the conversion between the two units is not possible. 33 * For example, conversion between `meter` and `second` is not possible. 34 * 35 * See the [Rust documentation for `converter`](https://docs.rs/icu/latest/icu/experimental/units/converter_factory/struct.ConverterFactory.html#method.converter) for more information. 36 */ 37 converter(from: MeasureUnit, to: MeasureUnit): UnitsConverter | null; 38 39 constructor(); 40 }