// generated by diplomat-tool import wasm from "./diplomat-wasm.mjs"; import * as diplomatRuntime from "./diplomat-runtime.mjs"; // Base enumerator definition /** Additional information: [1](https://docs.rs/icu/latest/icu/datetime/enum.DateTimeWriteError.html) */ export class DateTimeFormatError { #value = undefined; static #values = new Map([ ["Unknown", 0], ["MissingInputField", 1], ["ZoneInfoMissingFields", 2], ["InvalidEra", 3], ["InvalidMonthCode", 4], ["InvalidCyclicYear", 5], ["NamesNotLoaded", 16], ["FixedDecimalFormatterNotLoaded", 17], ["UnsupportedField", 18] ]); static getAllEntries() { return DateTimeFormatError.#values.entries(); } constructor(value) { if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) { // We pass in two internalConstructor arguments to create *new* // instances of this type, otherwise the enums are treated as singletons. if (arguments[1] === diplomatRuntime.internalConstructor ) { this.#value = arguments[2]; return; } return DateTimeFormatError.#objectValues[arguments[1]]; } if (value instanceof DateTimeFormatError) { return value; } let intVal = DateTimeFormatError.#values.get(value); // Nullish check, checks for null or undefined if (intVal == null) { return DateTimeFormatError.#objectValues[intVal]; } throw TypeError(value + " is not a DateTimeFormatError and does not correspond to any of its enumerator values."); } get value() { for (let entry of DateTimeFormatError.#values) { if (entry[1] == this.#value) { return entry[0]; } } } get ffiValue() { return this.#value; } static #objectValues = { [0]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0), [1]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1), [2]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2), [3]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3), [4]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4), [5]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5), [16]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 16), [17]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 17), [18]: new DateTimeFormatError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 18), }; static Unknown = DateTimeFormatError.#objectValues[0]; static MissingInputField = DateTimeFormatError.#objectValues[1]; static ZoneInfoMissingFields = DateTimeFormatError.#objectValues[2]; static InvalidEra = DateTimeFormatError.#objectValues[3]; static InvalidMonthCode = DateTimeFormatError.#objectValues[4]; static InvalidCyclicYear = DateTimeFormatError.#objectValues[5]; static NamesNotLoaded = DateTimeFormatError.#objectValues[16]; static FixedDecimalFormatterNotLoaded = DateTimeFormatError.#objectValues[17]; static UnsupportedField = DateTimeFormatError.#objectValues[18]; }