| // generated by diplomat-tool |
| import wasm from "./diplomat-wasm.mjs"; |
| import * as diplomatRuntime from "./diplomat-runtime.mjs"; |
| |
| |
| /** See the [Rust documentation for `LeadingAdjustment`](https://docs.rs/icu/latest/icu/casemap/options/enum.LeadingAdjustment.html) for more information. |
| */ |
| |
| |
| export class LeadingAdjustment { |
| |
| #value = undefined; |
| |
| static #values = new Map([ |
| ["Auto", 0], |
| ["None", 1], |
| ["ToCased", 2] |
| ]); |
| |
| static getAllEntries() { |
| return LeadingAdjustment.#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 LeadingAdjustment.#objectValues[arguments[1]]; |
| } |
| |
| if (value instanceof LeadingAdjustment) { |
| return value; |
| } |
| |
| let intVal = LeadingAdjustment.#values.get(value); |
| |
| // Nullish check, checks for null or undefined |
| if (intVal != null) { |
| return LeadingAdjustment.#objectValues[intVal]; |
| } |
| |
| throw TypeError(value + " is not a LeadingAdjustment and does not correspond to any of its enumerator values."); |
| } |
| |
| static fromValue(value) { |
| return new LeadingAdjustment(value); |
| } |
| |
| get value() { |
| return [...LeadingAdjustment.#values.keys()][this.#value]; |
| } |
| |
| get ffiValue() { |
| return this.#value; |
| } |
| static #objectValues = [ |
| new LeadingAdjustment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0), |
| new LeadingAdjustment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1), |
| new LeadingAdjustment(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2), |
| ]; |
| |
| static Auto = LeadingAdjustment.#objectValues[0]; |
| static None = LeadingAdjustment.#objectValues[1]; |
| static ToCased = LeadingAdjustment.#objectValues[2]; |
| |
| constructor(value) { |
| return this.#internalConstructor(...arguments) |
| } |
| } |