| 1 | import { u8, i16, i32, u32, i64, u64, f64 } from "./diplomat-runtime" |
| 2 | import { FFIError } from "./diplomat-runtime" |
| 3 | import { ICU4XError } from "./ICU4XError"; |
| 4 | import { ICU4XFixedDecimalSign } from "./ICU4XFixedDecimalSign"; |
| 5 | import { ICU4XFixedDecimalSignDisplay } from "./ICU4XFixedDecimalSignDisplay"; |
| 6 | import { ICU4XRoundingIncrement } from "./ICU4XRoundingIncrement"; |
| 7 | |
| 8 | /** |
| 9 | |
| 10 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html Rust documentation for `FixedDecimal`} for more information. |
| 11 | */ |
| 12 | export class ICU4XFixedDecimal { |
| 13 | |
| 14 | /** |
| 15 | |
| 16 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from an integer. |
| 17 | |
| 18 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html Rust documentation for `FixedDecimal`} for more information. |
| 19 | */ |
| 20 | static create_from_i32(v: i32): ICU4XFixedDecimal; |
| 21 | |
| 22 | /** |
| 23 | |
| 24 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from an integer. |
| 25 | |
| 26 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html Rust documentation for `FixedDecimal`} for more information. |
| 27 | */ |
| 28 | static create_from_u32(v: u32): ICU4XFixedDecimal; |
| 29 | |
| 30 | /** |
| 31 | |
| 32 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from an integer. |
| 33 | |
| 34 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html Rust documentation for `FixedDecimal`} for more information. |
| 35 | */ |
| 36 | static create_from_i64(v: i64): ICU4XFixedDecimal; |
| 37 | |
| 38 | /** |
| 39 | |
| 40 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from an integer. |
| 41 | |
| 42 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html Rust documentation for `FixedDecimal`} for more information. |
| 43 | */ |
| 44 | static create_from_u64(v: u64): ICU4XFixedDecimal; |
| 45 | |
| 46 | /** |
| 47 | |
| 48 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from an integer-valued float |
| 49 | |
| 50 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64 Rust documentation for `try_from_f64`} for more information. |
| 51 | |
| 52 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html Rust documentation for `FloatPrecision`} for more information. |
| 53 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 54 | */ |
| 55 | static create_from_f64_with_integer_precision(f: f64): ICU4XFixedDecimal | never; |
| 56 | |
| 57 | /** |
| 58 | |
| 59 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from an float, with a given power of 10 for the lower magnitude |
| 60 | |
| 61 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64 Rust documentation for `try_from_f64`} for more information. |
| 62 | |
| 63 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html Rust documentation for `FloatPrecision`} for more information. |
| 64 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 65 | */ |
| 66 | static create_from_f64_with_lower_magnitude(f: f64, magnitude: i16): ICU4XFixedDecimal | never; |
| 67 | |
| 68 | /** |
| 69 | |
| 70 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from an float, for a given number of significant digits |
| 71 | |
| 72 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64 Rust documentation for `try_from_f64`} for more information. |
| 73 | |
| 74 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html Rust documentation for `FloatPrecision`} for more information. |
| 75 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 76 | */ |
| 77 | static create_from_f64_with_significant_digits(f: f64, digits: u8): ICU4XFixedDecimal | never; |
| 78 | |
| 79 | /** |
| 80 | |
| 81 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from an float, with enough digits to recover the original floating point in IEEE 754 without needing trailing zeros |
| 82 | |
| 83 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64 Rust documentation for `try_from_f64`} for more information. |
| 84 | |
| 85 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html Rust documentation for `FloatPrecision`} for more information. |
| 86 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 87 | */ |
| 88 | static create_from_f64_with_floating_precision(f: f64): ICU4XFixedDecimal | never; |
| 89 | |
| 90 | /** |
| 91 | |
| 92 | * Construct an {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} from a string. |
| 93 | |
| 94 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.from_str Rust documentation for `from_str`} for more information. |
| 95 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 96 | */ |
| 97 | static create_from_string(v: string): ICU4XFixedDecimal | never; |
| 98 | |
| 99 | /** |
| 100 | |
| 101 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.digit_at Rust documentation for `digit_at`} for more information. |
| 102 | */ |
| 103 | digit_at(magnitude: i16): u8; |
| 104 | |
| 105 | /** |
| 106 | |
| 107 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.magnitude_range Rust documentation for `magnitude_range`} for more information. |
| 108 | */ |
| 109 | magnitude_start(): i16; |
| 110 | |
| 111 | /** |
| 112 | |
| 113 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.magnitude_range Rust documentation for `magnitude_range`} for more information. |
| 114 | */ |
| 115 | magnitude_end(): i16; |
| 116 | |
| 117 | /** |
| 118 | |
| 119 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.nonzero_magnitude_start Rust documentation for `nonzero_magnitude_start`} for more information. |
| 120 | */ |
| 121 | nonzero_magnitude_start(): i16; |
| 122 | |
| 123 | /** |
| 124 | |
| 125 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.nonzero_magnitude_end Rust documentation for `nonzero_magnitude_end`} for more information. |
| 126 | */ |
| 127 | nonzero_magnitude_end(): i16; |
| 128 | |
| 129 | /** |
| 130 | |
| 131 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.is_zero Rust documentation for `is_zero`} for more information. |
| 132 | */ |
| 133 | is_zero(): boolean; |
| 134 | |
| 135 | /** |
| 136 | |
| 137 | * Multiply the {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} by a given power of ten. |
| 138 | |
| 139 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.multiply_pow10 Rust documentation for `multiply_pow10`} for more information. |
| 140 | */ |
| 141 | multiply_pow10(power: i16): void; |
| 142 | |
| 143 | /** |
| 144 | |
| 145 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.sign Rust documentation for `sign`} for more information. |
| 146 | */ |
| 147 | sign(): ICU4XFixedDecimalSign; |
| 148 | |
| 149 | /** |
| 150 | |
| 151 | * Set the sign of the {@link ICU4XFixedDecimal `ICU4XFixedDecimal`}. |
| 152 | |
| 153 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.set_sign Rust documentation for `set_sign`} for more information. |
| 154 | */ |
| 155 | set_sign(sign: ICU4XFixedDecimalSign): void; |
| 156 | |
| 157 | /** |
| 158 | |
| 159 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.apply_sign_display Rust documentation for `apply_sign_display`} for more information. |
| 160 | */ |
| 161 | apply_sign_display(sign_display: ICU4XFixedDecimalSignDisplay): void; |
| 162 | |
| 163 | /** |
| 164 | |
| 165 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trim_start Rust documentation for `trim_start`} for more information. |
| 166 | */ |
| 167 | trim_start(): void; |
| 168 | |
| 169 | /** |
| 170 | |
| 171 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trim_end Rust documentation for `trim_end`} for more information. |
| 172 | */ |
| 173 | trim_end(): void; |
| 174 | |
| 175 | /** |
| 176 | |
| 177 | * Zero-pad the {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} on the left to a particular position |
| 178 | |
| 179 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.pad_start Rust documentation for `pad_start`} for more information. |
| 180 | */ |
| 181 | pad_start(position: i16): void; |
| 182 | |
| 183 | /** |
| 184 | |
| 185 | * Zero-pad the {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} on the right to a particular position |
| 186 | |
| 187 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.pad_end Rust documentation for `pad_end`} for more information. |
| 188 | */ |
| 189 | pad_end(position: i16): void; |
| 190 | |
| 191 | /** |
| 192 | |
| 193 | * Truncate the {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} on the left to a particular position, deleting digits if necessary. This is useful for, e.g. abbreviating years ("2022" -> "22") |
| 194 | |
| 195 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.set_max_position Rust documentation for `set_max_position`} for more information. |
| 196 | */ |
| 197 | set_max_position(position: i16): void; |
| 198 | |
| 199 | /** |
| 200 | |
| 201 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trunc Rust documentation for `trunc`} for more information. |
| 202 | */ |
| 203 | trunc(position: i16): void; |
| 204 | |
| 205 | /** |
| 206 | |
| 207 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trunc_to_increment Rust documentation for `trunc_to_increment`} for more information. |
| 208 | */ |
| 209 | trunc_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 210 | |
| 211 | /** |
| 212 | |
| 213 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_trunc Rust documentation for `half_trunc`} for more information. |
| 214 | */ |
| 215 | half_trunc(position: i16): void; |
| 216 | |
| 217 | /** |
| 218 | |
| 219 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_trunc_to_increment Rust documentation for `half_trunc_to_increment`} for more information. |
| 220 | */ |
| 221 | half_trunc_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 222 | |
| 223 | /** |
| 224 | |
| 225 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.expand Rust documentation for `expand`} for more information. |
| 226 | */ |
| 227 | expand(position: i16): void; |
| 228 | |
| 229 | /** |
| 230 | |
| 231 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.expand_to_increment Rust documentation for `expand_to_increment`} for more information. |
| 232 | */ |
| 233 | expand_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 234 | |
| 235 | /** |
| 236 | |
| 237 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_expand Rust documentation for `half_expand`} for more information. |
| 238 | */ |
| 239 | half_expand(position: i16): void; |
| 240 | |
| 241 | /** |
| 242 | |
| 243 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_expand_to_increment Rust documentation for `half_expand_to_increment`} for more information. |
| 244 | */ |
| 245 | half_expand_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 246 | |
| 247 | /** |
| 248 | |
| 249 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.ceil Rust documentation for `ceil`} for more information. |
| 250 | */ |
| 251 | ceil(position: i16): void; |
| 252 | |
| 253 | /** |
| 254 | |
| 255 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.ceil_to_increment Rust documentation for `ceil_to_increment`} for more information. |
| 256 | */ |
| 257 | ceil_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 258 | |
| 259 | /** |
| 260 | |
| 261 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_ceil Rust documentation for `half_ceil`} for more information. |
| 262 | */ |
| 263 | half_ceil(position: i16): void; |
| 264 | |
| 265 | /** |
| 266 | |
| 267 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_ceil_to_increment Rust documentation for `half_ceil_to_increment`} for more information. |
| 268 | */ |
| 269 | half_ceil_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 270 | |
| 271 | /** |
| 272 | |
| 273 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.floor Rust documentation for `floor`} for more information. |
| 274 | */ |
| 275 | floor(position: i16): void; |
| 276 | |
| 277 | /** |
| 278 | |
| 279 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.floor_to_increment Rust documentation for `floor_to_increment`} for more information. |
| 280 | */ |
| 281 | floor_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 282 | |
| 283 | /** |
| 284 | |
| 285 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_floor Rust documentation for `half_floor`} for more information. |
| 286 | */ |
| 287 | half_floor(position: i16): void; |
| 288 | |
| 289 | /** |
| 290 | |
| 291 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_floor_to_increment Rust documentation for `half_floor_to_increment`} for more information. |
| 292 | */ |
| 293 | half_floor_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 294 | |
| 295 | /** |
| 296 | |
| 297 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_even Rust documentation for `half_even`} for more information. |
| 298 | */ |
| 299 | half_even(position: i16): void; |
| 300 | |
| 301 | /** |
| 302 | |
| 303 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_even_to_increment Rust documentation for `half_even_to_increment`} for more information. |
| 304 | */ |
| 305 | half_even_to_increment(position: i16, increment: ICU4XRoundingIncrement): void; |
| 306 | |
| 307 | /** |
| 308 | |
| 309 | * Concatenates `other` to the end of `self`. |
| 310 | |
| 311 | * If successful, `other` will be set to 0 and a successful status is returned. |
| 312 | |
| 313 | * If not successful, `other` will be unchanged and an error is returned. |
| 314 | |
| 315 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.concatenate_end Rust documentation for `concatenate_end`} for more information. |
| 316 | * @throws {@link FFIError}<void> |
| 317 | */ |
| 318 | concatenate_end(other: ICU4XFixedDecimal): void | never; |
| 319 | |
| 320 | /** |
| 321 | |
| 322 | * Format the {@link ICU4XFixedDecimal `ICU4XFixedDecimal`} as a string. |
| 323 | |
| 324 | * See the {@link https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.write_to Rust documentation for `write_to`} for more information. |
| 325 | */ |
| 326 | to_string(): string; |
| 327 | } |