1// generated by diplomat-tool 2import wasm from "./diplomat-wasm.mjs"; 3import * as diplomatRuntime from "./diplomat-runtime.mjs"; 4 5 6/** See the [Rust documentation for `AlternateHandling`](https://docs.rs/icu/latest/icu/collator/options/enum.AlternateHandling.html) for more information. 7*/ 8 9 10export class CollatorAlternateHandling { 11 12 #value = undefined; 13 14 static #values = new Map([ 15 ["NonIgnorable", 0], 16 ["Shifted", 1] 17 ]); 18 19 static getAllEntries() { 20 return CollatorAlternateHandling.#values.entries(); 21 } 22 23 #internalConstructor(value) { 24 if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) { 25 // We pass in two internalConstructor arguments to create *new* 26 // instances of this type, otherwise the enums are treated as singletons. 27 if (arguments[1] === diplomatRuntime.internalConstructor ) { 28 this.#value = arguments[2]; 29 return this; 30 } 31 return CollatorAlternateHandling.#objectValues[arguments[1]]; 32 } 33 34 if (value instanceof CollatorAlternateHandling) { 35 return value; 36 } 37 38 let intVal = CollatorAlternateHandling.#values.get(value); 39 40 // Nullish check, checks for null or undefined 41 if (intVal != null) { 42 return CollatorAlternateHandling.#objectValues[intVal]; 43 } 44 45 throw TypeError(value + " is not a CollatorAlternateHandling and does not correspond to any of its enumerator values."); 46 } 47 48 static fromValue(value) { 49 return new CollatorAlternateHandling(value); 50 } 51 52 get value() { 53 return [...CollatorAlternateHandling.#values.keys()][this.#value]; 54 } 55 56 get ffiValue() { 57 return this.#value; 58 } 59 static #objectValues = [ 60 new CollatorAlternateHandling(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0), 61 new CollatorAlternateHandling(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1), 62 ]; 63 64 static NonIgnorable = CollatorAlternateHandling.#objectValues[0]; 65 static Shifted = CollatorAlternateHandling.#objectValues[1]; 66 67 constructor(value) { 68 return this.#internalConstructor(...arguments) 69 } 70}