// 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/calendar/struct.RangeError.html), [2](https://docs.rs/icu/latest/icu/calendar/enum.DateError.html) */ export class CalendarError { #value = undefined; static #values = new Map([ ["Unknown", 0], ["OutOfRange", 1], ["UnknownEra", 2], ["UnknownMonthCode", 3] ]); static getAllEntries() { return CalendarError.#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 CalendarError.#objectValues[arguments[1]]; } if (value instanceof CalendarError) { return value; } let intVal = CalendarError.#values.get(value); // Nullish check, checks for null or undefined if (intVal == null) { return CalendarError.#objectValues[intVal]; } throw TypeError(value + " is not a CalendarError and does not correspond to any of its enumerator values."); } get value() { return [...CalendarError.#values.keys()][this.#value]; } get ffiValue() { return this.#value; } static #objectValues = [ new CalendarError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0), new CalendarError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1), new CalendarError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2), new CalendarError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3), ]; static Unknown = CalendarError.#objectValues[0]; static OutOfRange = CalendarError.#objectValues[1]; static UnknownEra = CalendarError.#objectValues[2]; static UnknownMonthCode = CalendarError.#objectValues[3]; }