Source code

Revision control

Copy as Markdown

Other Tools

// generated by diplomat-tool
import wasm from "./diplomat-wasm.mjs";
import * as diplomatRuntime from "./diplomat-runtime.mjs";
/**
* 🚧 This API is experimental and may experience breaking changes outside major releases.
*
* See the [Rust documentation for `Overflow`](https://docs.rs/icu/2.1.1/icu/calendar/options/enum.Overflow.html) for more information.
*/
export class DateOverflow {
#value = undefined;
static #values = new Map([
["Constrain", 0],
["Reject", 1]
]);
static getAllEntries() {
return DateOverflow.#values.entries();
}
#internalConstructor(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 this;
}
return DateOverflow.#objectValues[arguments[1]];
}
if (value instanceof DateOverflow) {
return value;
}
let intVal = DateOverflow.#values.get(value);
// Nullish check, checks for null or undefined
if (intVal != null) {
return DateOverflow.#objectValues[intVal];
}
throw TypeError(value + " is not a DateOverflow and does not correspond to any of its enumerator values.");
}
/** @internal */
static fromValue(value) {
return new DateOverflow(value);
}
get value(){
return [...DateOverflow.#values.keys()][this.#value];
}
/** @internal */
get ffiValue(){
return this.#value;
}
static #objectValues = [
new DateOverflow(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
new DateOverflow(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
];
static Constrain = DateOverflow.#objectValues[0];
static Reject = DateOverflow.#objectValues[1];
constructor(value) {
return this.#internalConstructor(...arguments)
}
}