| 1 |
import { i32 } from "./diplomat-runtime" |
| 2 |
import { FFIError } from "./diplomat-runtime" |
| 3 |
import { ICU4XError } from "./ICU4XError"; |
| 4 |
import { ICU4XIanaToBcp47Mapper } from "./ICU4XIanaToBcp47Mapper"; |
| 5 |
import { ICU4XIsoDateTime } from "./ICU4XIsoDateTime"; |
| 6 |
import { ICU4XMetazoneCalculator } from "./ICU4XMetazoneCalculator"; |
| 7 |
import { ICU4XTimeZoneIdMapper } from "./ICU4XTimeZoneIdMapper"; |
| 8 |
|
| 9 |
/** |
| 10 |
|
| 11 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html Rust documentation for `CustomTimeZone`} for more information. |
| 12 |
*/ |
| 13 |
export class ICU4XCustomTimeZone { |
| 14 |
|
| 15 |
/** |
| 16 |
|
| 17 |
* Creates a time zone from an offset string. |
| 18 |
|
| 19 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.from_str Rust documentation for `from_str`} for more information. |
| 20 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 21 |
*/ |
| 22 |
static create_from_string(s: string): ICU4XCustomTimeZone | never; |
| 23 |
|
| 24 |
/** |
| 25 |
|
| 26 |
* Creates a time zone with no information. |
| 27 |
|
| 28 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.new_empty Rust documentation for `new_empty`} for more information. |
| 29 |
*/ |
| 30 |
static create_empty(): ICU4XCustomTimeZone; |
| 31 |
|
| 32 |
/** |
| 33 |
|
| 34 |
* Creates a time zone for UTC. |
| 35 |
|
| 36 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.utc Rust documentation for `utc`} for more information. |
| 37 |
*/ |
| 38 |
static create_utc(): ICU4XCustomTimeZone; |
| 39 |
|
| 40 |
/** |
| 41 |
|
| 42 |
* Sets the `gmt_offset` field from offset seconds. |
| 43 |
|
| 44 |
* Errors if the offset seconds are out of range. |
| 45 |
|
| 46 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.try_from_offset_seconds Rust documentation for `try_from_offset_seconds`} for more information. |
| 47 |
|
| 48 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html 1} |
| 49 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 50 |
*/ |
| 51 |
try_set_gmt_offset_seconds(offset_seconds: i32): void | never; |
| 52 |
|
| 53 |
/** |
| 54 |
|
| 55 |
* Clears the `gmt_offset` field. |
| 56 |
|
| 57 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.offset_seconds Rust documentation for `offset_seconds`} for more information. |
| 58 |
|
| 59 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html 1} |
| 60 |
*/ |
| 61 |
clear_gmt_offset(): void; |
| 62 |
|
| 63 |
/** |
| 64 |
|
| 65 |
* Returns the value of the `gmt_offset` field as offset seconds. |
| 66 |
|
| 67 |
* Errors if the `gmt_offset` field is empty. |
| 68 |
|
| 69 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.offset_seconds Rust documentation for `offset_seconds`} for more information. |
| 70 |
|
| 71 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html 1} |
| 72 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 73 |
*/ |
| 74 |
gmt_offset_seconds(): i32 | never; |
| 75 |
|
| 76 |
/** |
| 77 |
|
| 78 |
* Returns whether the `gmt_offset` field is positive. |
| 79 |
|
| 80 |
* Errors if the `gmt_offset` field is empty. |
| 81 |
|
| 82 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.is_positive Rust documentation for `is_positive`} for more information. |
| 83 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 84 |
*/ |
| 85 |
is_gmt_offset_positive(): boolean | never; |
| 86 |
|
| 87 |
/** |
| 88 |
|
| 89 |
* Returns whether the `gmt_offset` field is zero. |
| 90 |
|
| 91 |
* Errors if the `gmt_offset` field is empty (which is not the same as zero). |
| 92 |
|
| 93 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.is_zero Rust documentation for `is_zero`} for more information. |
| 94 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 95 |
*/ |
| 96 |
is_gmt_offset_zero(): boolean | never; |
| 97 |
|
| 98 |
/** |
| 99 |
|
| 100 |
* Returns whether the `gmt_offset` field has nonzero minutes. |
| 101 |
|
| 102 |
* Errors if the `gmt_offset` field is empty. |
| 103 |
|
| 104 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.has_minutes Rust documentation for `has_minutes`} for more information. |
| 105 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 106 |
*/ |
| 107 |
gmt_offset_has_minutes(): boolean | never; |
| 108 |
|
| 109 |
/** |
| 110 |
|
| 111 |
* Returns whether the `gmt_offset` field has nonzero seconds. |
| 112 |
|
| 113 |
* Errors if the `gmt_offset` field is empty. |
| 114 |
|
| 115 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.GmtOffset.html#method.has_seconds Rust documentation for `has_seconds`} for more information. |
| 116 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 117 |
*/ |
| 118 |
gmt_offset_has_seconds(): boolean | never; |
| 119 |
|
| 120 |
/** |
| 121 |
|
| 122 |
* Sets the `time_zone_id` field from a BCP-47 string. |
| 123 |
|
| 124 |
* Errors if the string is not a valid BCP-47 time zone ID. |
| 125 |
|
| 126 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id Rust documentation for `time_zone_id`} for more information. |
| 127 |
|
| 128 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html 1} |
| 129 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 130 |
*/ |
| 131 |
try_set_time_zone_id(id: string): void | never; |
| 132 |
|
| 133 |
/** |
| 134 |
|
| 135 |
* Sets the `time_zone_id` field from an IANA string by looking up the corresponding BCP-47 string. |
| 136 |
|
| 137 |
* Errors if the string is not a valid BCP-47 time zone ID. |
| 138 |
|
| 139 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47MapperBorrowed.html#method.get Rust documentation for `get`} for more information. |
| 140 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 141 |
*/ |
| 142 |
try_set_iana_time_zone_id(mapper: ICU4XIanaToBcp47Mapper, id: string): void | never; |
| 143 |
|
| 144 |
/** |
| 145 |
|
| 146 |
* Sets the `time_zone_id` field from an IANA string by looking up the corresponding BCP-47 string. |
| 147 |
|
| 148 |
* Errors if the string is not a valid BCP-47 time zone ID. |
| 149 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 150 |
*/ |
| 151 |
try_set_iana_time_zone_id_2(mapper: ICU4XTimeZoneIdMapper, id: string): void | never; |
| 152 |
|
| 153 |
/** |
| 154 |
|
| 155 |
* Clears the `time_zone_id` field. |
| 156 |
|
| 157 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id Rust documentation for `time_zone_id`} for more information. |
| 158 |
|
| 159 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html 1} |
| 160 |
*/ |
| 161 |
clear_time_zone_id(): void; |
| 162 |
|
| 163 |
/** |
| 164 |
|
| 165 |
* Writes the value of the `time_zone_id` field as a string. |
| 166 |
|
| 167 |
* Errors if the `time_zone_id` field is empty. |
| 168 |
|
| 169 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.time_zone_id Rust documentation for `time_zone_id`} for more information. |
| 170 |
|
| 171 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.TimeZoneBcp47Id.html 1} |
| 172 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 173 |
*/ |
| 174 |
time_zone_id(): string | never; |
| 175 |
|
| 176 |
/** |
| 177 |
|
| 178 |
* Sets the `metazone_id` field from a string. |
| 179 |
|
| 180 |
* Errors if the string is not a valid BCP-47 metazone ID. |
| 181 |
|
| 182 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id Rust documentation for `metazone_id`} for more information. |
| 183 |
|
| 184 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html 1} |
| 185 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 186 |
*/ |
| 187 |
try_set_metazone_id(id: string): void | never; |
| 188 |
|
| 189 |
/** |
| 190 |
|
| 191 |
* Clears the `metazone_id` field. |
| 192 |
|
| 193 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id Rust documentation for `metazone_id`} for more information. |
| 194 |
|
| 195 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html 1} |
| 196 |
*/ |
| 197 |
clear_metazone_id(): void; |
| 198 |
|
| 199 |
/** |
| 200 |
|
| 201 |
* Writes the value of the `metazone_id` field as a string. |
| 202 |
|
| 203 |
* Errors if the `metazone_id` field is empty. |
| 204 |
|
| 205 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.metazone_id Rust documentation for `metazone_id`} for more information. |
| 206 |
|
| 207 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.MetazoneId.html 1} |
| 208 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 209 |
*/ |
| 210 |
metazone_id(): string | never; |
| 211 |
|
| 212 |
/** |
| 213 |
|
| 214 |
* Sets the `zone_variant` field from a string. |
| 215 |
|
| 216 |
* Errors if the string is not a valid zone variant. |
| 217 |
|
| 218 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant Rust documentation for `zone_variant`} for more information. |
| 219 |
|
| 220 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html 1} |
| 221 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 222 |
*/ |
| 223 |
try_set_zone_variant(id: string): void | never; |
| 224 |
|
| 225 |
/** |
| 226 |
|
| 227 |
* Clears the `zone_variant` field. |
| 228 |
|
| 229 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant Rust documentation for `zone_variant`} for more information. |
| 230 |
|
| 231 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html 1} |
| 232 |
*/ |
| 233 |
clear_zone_variant(): void; |
| 234 |
|
| 235 |
/** |
| 236 |
|
| 237 |
* Writes the value of the `zone_variant` field as a string. |
| 238 |
|
| 239 |
* Errors if the `zone_variant` field is empty. |
| 240 |
|
| 241 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant Rust documentation for `zone_variant`} for more information. |
| 242 |
|
| 243 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html 1} |
| 244 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 245 |
*/ |
| 246 |
zone_variant(): string | never; |
| 247 |
|
| 248 |
/** |
| 249 |
|
| 250 |
* Sets the `zone_variant` field to "standard" time, which may or may not correspond to a display name with "Standard" in its name. |
| 251 |
|
| 252 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.standard Rust documentation for `standard`} for more information. |
| 253 |
|
| 254 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant 1} |
| 255 |
*/ |
| 256 |
set_standard_time(): void; |
| 257 |
|
| 258 |
/** |
| 259 |
|
| 260 |
* Sets the `zone_variant` field to "daylight" time, which may or may not correspond to a display name with "Daylight" in its name. |
| 261 |
|
| 262 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.daylight Rust documentation for `daylight`} for more information. |
| 263 |
|
| 264 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant 1} |
| 265 |
*/ |
| 266 |
set_daylight_time(): void; |
| 267 |
|
| 268 |
/** |
| 269 |
|
| 270 |
* Returns whether the `zone_variant` field is standard time. |
| 271 |
|
| 272 |
* Errors if the `zone_variant` field is empty. |
| 273 |
|
| 274 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.standard Rust documentation for `standard`} for more information. |
| 275 |
|
| 276 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant 1} |
| 277 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 278 |
*/ |
| 279 |
is_standard_time(): boolean | never; |
| 280 |
|
| 281 |
/** |
| 282 |
|
| 283 |
* Returns whether the `zone_variant` field is daylight time. |
| 284 |
|
| 285 |
* Errors if the `zone_variant` field is empty. |
| 286 |
|
| 287 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.ZoneVariant.html#method.daylight Rust documentation for `daylight`} for more information. |
| 288 |
|
| 289 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#structfield.zone_variant 1} |
| 290 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 291 |
*/ |
| 292 |
is_daylight_time(): boolean | never; |
| 293 |
|
| 294 |
/** |
| 295 |
|
| 296 |
* Sets the metazone based on the time zone and the local timestamp. |
| 297 |
|
| 298 |
* See the {@link https://docs.rs/icu/latest/icu/timezone/struct.CustomTimeZone.html#method.maybe_calculate_metazone Rust documentation for `maybe_calculate_metazone`} for more information. |
| 299 |
|
| 300 |
* Additional information: {@link https://docs.rs/icu/latest/icu/timezone/struct.MetazoneCalculator.html#method.compute_metazone_from_time_zone 1} |
| 301 |
*/ |
| 302 |
maybe_calculate_metazone(metazone_calculator: ICU4XMetazoneCalculator, local_datetime: ICU4XIsoDateTime): void; |
| 303 |
} |